diff --git a/DEPS b/DEPS index ca40979..e3ac78e6 100644 --- a/DEPS +++ b/DEPS
@@ -105,11 +105,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': '774b566c13088006f4ca8c358c60352d76795678', + 'skia_revision': '0ff03808e3449ac4aa7bc84b8ae85f1765400358', # 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': '604c50c84e672c099cbcbd6dd19928a0381d9688', + 'v8_revision': 'e4c6d03d3deaa661d0ca7f090877565f66c1a243', # 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. @@ -117,7 +117,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': 'fcfd3382d4abfebd07371d5f35609d26f79cb6b7', + 'angle_revision': '2c8f0845431dbbb8e712ad92a6f409c00de1e681', # 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. @@ -584,7 +584,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '57988b451c5ca7db1f6321aecc90fb7af664b838', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '274a6922da390684d70ff9aeb321146f02c7df3b', 'condition': 'checkout_linux', }, @@ -599,7 +599,7 @@ # For Linux and Chromium OS. 'src/third_party/cros_system_api': { - 'url': Var('chromium_git') + '/chromiumos/platform/system_api.git' + '@' + 'b03af0353854028bfae0ce978e8666e815f621b9', + 'url': Var('chromium_git') + '/chromiumos/platform/system_api.git' + '@' + '48093e2673c64d27062da7df353d7f7cf2aa398f', 'condition': 'checkout_linux', }, @@ -609,7 +609,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '07b5283a4ea1056007f6c2ec233411b72caa3227', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '69f640ec0900add7fd44579c181fa99ea1693005', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -943,7 +943,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'c42c66b2dd053527068cab84c7af44df08b00475', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '1bbc63df5b823d9af66cd0d745e041e257a9bdb9', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78', @@ -1129,7 +1129,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@0c858b7a312a2ab8e1f61e4a328f9f9b12882b90', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@eaac597484d5f0e17e49a0ac8f170f93e574624a', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/browser/aw_render_thread_context_provider.cc b/android_webview/browser/aw_render_thread_context_provider.cc index e9a229e..95e06d50 100644 --- a/android_webview/browser/aw_render_thread_context_provider.cc +++ b/android_webview/browser/aw_render_thread_context_provider.cc
@@ -149,6 +149,11 @@ return gr_context_.get(); } +gpu::SharedImageInterface* +AwRenderThreadContextProvider::SharedImageInterface() { + return context_->GetSharedImageInterface(); +} + viz::ContextCacheController* AwRenderThreadContextProvider::CacheController() { DCHECK(main_thread_checker_.CalledOnValidThread()); return cache_controller_.get();
diff --git a/android_webview/browser/aw_render_thread_context_provider.h b/android_webview/browser/aw_render_thread_context_provider.h index 9d4ef39..3767baff 100644 --- a/android_webview/browser/aw_render_thread_context_provider.h +++ b/android_webview/browser/aw_render_thread_context_provider.h
@@ -51,6 +51,7 @@ gpu::gles2::GLES2Interface* ContextGL() override; gpu::ContextSupport* ContextSupport() override; class GrContext* GrContext() override; + gpu::SharedImageInterface* SharedImageInterface() override; viz::ContextCacheController* CacheController() override; base::Lock* GetLock() override; void AddObserver(viz::ContextLostObserver* obs) override;
diff --git a/ash/assistant/assistant_interaction_controller.cc b/ash/assistant/assistant_interaction_controller.cc index 595fa3f..a90e8fb 100644 --- a/ash/assistant/assistant_interaction_controller.cc +++ b/ash/assistant/assistant_interaction_controller.cc
@@ -17,12 +17,28 @@ #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/voice_interaction/voice_interaction_controller.h" +#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/optional.h" #include "base/strings/utf_string_conversions.h" #include "ui/base/l10n/l10n_util.h" namespace ash { +namespace { + +// Helpers --------------------------------------------------------------------- + +// Returns true if device is in tablet mode, false otherwise. +bool IsTabletMode() { + return Shell::Get() + ->tablet_mode_controller() + ->IsTabletModeWindowManagerEnabled(); +} + +} // namespace + +// AssistantInteractionController ---------------------------------------------- + AssistantInteractionController::AssistantInteractionController( AssistantController* assistant_controller) : assistant_controller_(assistant_controller), @@ -146,7 +162,10 @@ model_.SetInputModality(InputModality::kKeyboard); break; case AssistantVisibility::kVisible: - if (source == AssistantSource::kLongPressLauncher) { + if (source == AssistantSource::kLauncherSearchBox) { + if (IsTabletMode()) + StartVoiceInteraction(); + } else if (source == AssistantSource::kLongPressLauncher) { StartVoiceInteraction(); } else if (source == AssistantSource::kStylus) { model_.SetInputModality(InputModality::kStylus);
diff --git a/ash/assistant/model/assistant_ui_model.h b/ash/assistant/model/assistant_ui_model.h index 09a6991..ee598cb 100644 --- a/ash/assistant/model/assistant_ui_model.h +++ b/ash/assistant/model/assistant_ui_model.h
@@ -18,10 +18,10 @@ kDeepLink, kHotkey, kHotword, + kLauncherSearchBox, kLongPressLauncher, kSetup, kStylus, - kLauncherSearchBox, }; // Enumeration of Assistant UI modes.
diff --git a/ash/assistant/ui/assistant_container_view.cc b/ash/assistant/ui/assistant_container_view.cc index 522f853..914fce3 100644 --- a/ash/assistant/ui/assistant_container_view.cc +++ b/ash/assistant/ui/assistant_container_view.cc
@@ -195,6 +195,10 @@ window->SetProperty(kOnlyAllowMouseClickEvents, true); } +const char* AssistantContainerView::GetClassName() const { + return "AssistantContainerView"; +} + void AssistantContainerView::AddedToWidget() { GetWidget()->GetNativeWindow()->SetEventTargeter( std::make_unique<AssistantContainerEventTargeter>());
diff --git a/ash/assistant/ui/assistant_container_view.h b/ash/assistant/ui/assistant_container_view.h index 51c71b2..8b962d08 100644 --- a/ash/assistant/ui/assistant_container_view.h +++ b/ash/assistant/ui/assistant_container_view.h
@@ -46,6 +46,7 @@ static void OnlyAllowMouseClickEvents(aura::Window* window); // views::BubbleDialogDelegateView: + const char* GetClassName() const override; void AddedToWidget() override; int GetDialogButtons() const override; void ChildPreferredSizeChanged(views::View* child) override;
diff --git a/ash/assistant/ui/assistant_main_view.cc b/ash/assistant/ui/assistant_main_view.cc index 1d0ffb2..709f1e4 100644 --- a/ash/assistant/ui/assistant_main_view.cc +++ b/ash/assistant/ui/assistant_main_view.cc
@@ -70,6 +70,10 @@ assistant_controller_->ui_controller()->RemoveModelObserver(this); } +const char* AssistantMainView::GetClassName() const { + return "AssistantMainView"; +} + gfx::Size AssistantMainView::CalculatePreferredSize() const { return gfx::Size(kPreferredWidthDip, GetHeightForWidth(kPreferredWidthDip)); }
diff --git a/ash/assistant/ui/assistant_main_view.h b/ash/assistant/ui/assistant_main_view.h index e8a027d7..f2b3a6d 100644 --- a/ash/assistant/ui/assistant_main_view.h +++ b/ash/assistant/ui/assistant_main_view.h
@@ -22,6 +22,7 @@ ~AssistantMainView() override; // views::View: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override; void ChildPreferredSizeChanged(views::View* child) override;
diff --git a/ash/assistant/ui/assistant_mini_view.cc b/ash/assistant/ui/assistant_mini_view.cc index ad0fb6a1..4ee7f28 100644 --- a/ash/assistant/ui/assistant_mini_view.cc +++ b/ash/assistant/ui/assistant_mini_view.cc
@@ -51,6 +51,10 @@ assistant_controller_->interaction_controller()->RemoveModelObserver(this); } +const char* AssistantMiniView::GetClassName() const { + return "AssistantMiniView"; +} + gfx::Size AssistantMiniView::CalculatePreferredSize() const { const int preferred_width = std::min(views::View::CalculatePreferredSize().width(), kMaxWidthDip);
diff --git a/ash/assistant/ui/assistant_mini_view.h b/ash/assistant/ui/assistant_mini_view.h index e4110c24..07fd8e0 100644 --- a/ash/assistant/ui/assistant_mini_view.h +++ b/ash/assistant/ui/assistant_mini_view.h
@@ -43,6 +43,7 @@ ~AssistantMiniView() override; // views::View: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override; void ChildPreferredSizeChanged(views::View* child) override;
diff --git a/ash/assistant/ui/assistant_web_view.cc b/ash/assistant/ui/assistant_web_view.cc index 83c881f..14f755d 100644 --- a/ash/assistant/ui/assistant_web_view.cc +++ b/ash/assistant/ui/assistant_web_view.cc
@@ -42,6 +42,10 @@ ReleaseWebContents(); } +const char* AssistantWebView::GetClassName() const { + return "AssistantWebView"; +} + gfx::Size AssistantWebView::CalculatePreferredSize() const { return gfx::Size(kPreferredWidthDip, GetHeightForWidth(kPreferredWidthDip)); }
diff --git a/ash/assistant/ui/assistant_web_view.h b/ash/assistant/ui/assistant_web_view.h index 2103fc5..2a6869f 100644 --- a/ash/assistant/ui/assistant_web_view.h +++ b/ash/assistant/ui/assistant_web_view.h
@@ -5,7 +5,9 @@ #ifndef ASH_ASSISTANT_UI_ASSISTANT_WEB_VIEW_H_ #define ASH_ASSISTANT_UI_ASSISTANT_WEB_VIEW_H_ +#include <map> #include <memory> +#include <string> #include "ash/assistant/assistant_controller_observer.h" #include "ash/assistant/ui/caption_bar.h" @@ -35,6 +37,7 @@ ~AssistantWebView() override; // views::View: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override; void ChildPreferredSizeChanged(views::View* child) override;
diff --git a/ash/assistant/ui/base/assistant_button.cc b/ash/assistant/ui/base/assistant_button.cc index ecd6ab1..d11ea1d 100644 --- a/ash/assistant/ui/base/assistant_button.cc +++ b/ash/assistant/ui/base/assistant_button.cc
@@ -39,6 +39,10 @@ AssistantButton::~AssistantButton() = default; +const char* AssistantButton::GetClassName() const { + return "AssistantButton"; +} + void AssistantButton::OnBoundsChanged(const gfx::Rect& previous_bounds) { // Note that the current assumption is that button bounds are square. DCHECK_EQ(width(), height());
diff --git a/ash/assistant/ui/base/assistant_button.h b/ash/assistant/ui/base/assistant_button.h index 876472e..bad7b57 100644 --- a/ash/assistant/ui/base/assistant_button.h +++ b/ash/assistant/ui/base/assistant_button.h
@@ -18,6 +18,7 @@ ~AssistantButton() override; // views::Button: + const char* GetClassName() const override; void OnBoundsChanged(const gfx::Rect& previous_bounds) override; std::unique_ptr<views::InkDrop> CreateInkDrop() override; std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
diff --git a/ash/assistant/ui/base/assistant_scroll_view.cc b/ash/assistant/ui/base/assistant_scroll_view.cc index 68e1c32..8186b1a 100644 --- a/ash/assistant/ui/base/assistant_scroll_view.cc +++ b/ash/assistant/ui/base/assistant_scroll_view.cc
@@ -44,7 +44,8 @@ class InvisibleScrollBar : public views::OverlayScrollBar { public: - InvisibleScrollBar(bool horizontal) : views::OverlayScrollBar(horizontal) {} + explicit InvisibleScrollBar(bool horizontal) + : views::OverlayScrollBar(horizontal) {} ~InvisibleScrollBar() override = default; @@ -65,6 +66,10 @@ AssistantScrollView::~AssistantScrollView() = default; +const char* AssistantScrollView::GetClassName() const { + return "AssistantScrollView"; +} + void AssistantScrollView::OnViewPreferredSizeChanged(views::View* view) { OnContentsPreferredSizeChanged(content_view_); PreferredSizeChanged();
diff --git a/ash/assistant/ui/base/assistant_scroll_view.h b/ash/assistant/ui/base/assistant_scroll_view.h index 6fb107b..2a1e3d1b8 100644 --- a/ash/assistant/ui/base/assistant_scroll_view.h +++ b/ash/assistant/ui/base/assistant_scroll_view.h
@@ -16,6 +16,9 @@ AssistantScrollView(); ~AssistantScrollView() override; + // views::ScrollView: + const char* GetClassName() const override; + // views::ViewObserver: void OnViewPreferredSizeChanged(views::View* view) override;
diff --git a/ash/assistant/ui/caption_bar.cc b/ash/assistant/ui/caption_bar.cc index 61dfd73..3220065 100644 --- a/ash/assistant/ui/caption_bar.cc +++ b/ash/assistant/ui/caption_bar.cc
@@ -47,6 +47,10 @@ CaptionBar::~CaptionBar() = default; +const char* CaptionBar::GetClassName() const { + return "CaptionBar"; +} + bool CaptionBar::AcceleratorPressed(const ui::Accelerator& accelerator) { switch (accelerator.key_code()) { case ui::VKEY_BROWSER_BACK:
diff --git a/ash/assistant/ui/caption_bar.h b/ash/assistant/ui/caption_bar.h index 3d3e8b3a..6a0bef29 100644 --- a/ash/assistant/ui/caption_bar.h +++ b/ash/assistant/ui/caption_bar.h
@@ -39,6 +39,7 @@ ~CaptionBar() override; // views::View: + const char* GetClassName() const override; bool AcceleratorPressed(const ui::Accelerator& accelerator) override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override;
diff --git a/ash/assistant/ui/dialog_plate/action_view.cc b/ash/assistant/ui/dialog_plate/action_view.cc index c4d3a643..b88fe429 100644 --- a/ash/assistant/ui/dialog_plate/action_view.cc +++ b/ash/assistant/ui/dialog_plate/action_view.cc
@@ -37,6 +37,10 @@ assistant_controller_->interaction_controller()->RemoveModelObserver(this); } +const char* ActionView::GetClassName() const { + return "ActionView"; +} + gfx::Size ActionView::CalculatePreferredSize() const { return gfx::Size(kPreferredSizeDip, GetHeightForWidth(kPreferredSizeDip)); }
diff --git a/ash/assistant/ui/dialog_plate/action_view.h b/ash/assistant/ui/dialog_plate/action_view.h index 8dfdded..5837a3bd 100644 --- a/ash/assistant/ui/dialog_plate/action_view.h +++ b/ash/assistant/ui/dialog_plate/action_view.h
@@ -24,7 +24,8 @@ AssistantController* assistant_controller); ~ActionView() override; - // views::Button: + // AssistantButton: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override;
diff --git a/ash/assistant/ui/dialog_plate/dialog_plate.cc b/ash/assistant/ui/dialog_plate/dialog_plate.cc index a697326..9197c702 100644 --- a/ash/assistant/ui/dialog_plate/dialog_plate.cc +++ b/ash/assistant/ui/dialog_plate/dialog_plate.cc
@@ -92,6 +92,10 @@ observers_.RemoveObserver(observer); } +const char* DialogPlate::GetClassName() const { + return "DialogPlate"; +} + gfx::Size DialogPlate::CalculatePreferredSize() const { return gfx::Size(INT_MAX, GetHeightForWidth(INT_MAX)); }
diff --git a/ash/assistant/ui/dialog_plate/dialog_plate.h b/ash/assistant/ui/dialog_plate/dialog_plate.h index 744aa98..434ce3c 100644 --- a/ash/assistant/ui/dialog_plate/dialog_plate.h +++ b/ash/assistant/ui/dialog_plate/dialog_plate.h
@@ -73,6 +73,7 @@ void RemoveObserver(DialogPlateObserver* observer); // views::View: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override; void RequestFocus() override;
diff --git a/ash/assistant/ui/logo_view/logo_view.cc b/ash/assistant/ui/logo_view/logo_view.cc index f1a4a0a..2d76c9f 100644 --- a/ash/assistant/ui/logo_view/logo_view.cc +++ b/ash/assistant/ui/logo_view/logo_view.cc
@@ -45,6 +45,10 @@ state_animator_.StopAnimator(); } +const char* LogoView::GetClassName() const { + return "LogoView"; +} + void LogoView::SetState(BaseLogoView::State state, bool animate) { StateModel::State animator_state; switch (state) {
diff --git a/ash/assistant/ui/logo_view/logo_view.h b/ash/assistant/ui/logo_view/logo_view.h index e8c4a192..968ec72 100644 --- a/ash/assistant/ui/logo_view/logo_view.h +++ b/ash/assistant/ui/logo_view/logo_view.h
@@ -56,6 +56,7 @@ ~LogoView() override; // BaseLogoView: + const char* GetClassName() const override; void SetState(State state, bool animate) override; void SetSpeechLevel(float speech_level) override;
diff --git a/ash/assistant/ui/main_stage/assistant_footer_view.cc b/ash/assistant/ui/main_stage/assistant_footer_view.cc index 1ab8c63..4ac1ca052 100644 --- a/ash/assistant/ui/main_stage/assistant_footer_view.cc +++ b/ash/assistant/ui/main_stage/assistant_footer_view.cc
@@ -59,6 +59,10 @@ AssistantFooterView::~AssistantFooterView() = default; +const char* AssistantFooterView::GetClassName() const { + return "AssistantFooterView"; +} + gfx::Size AssistantFooterView::CalculatePreferredSize() const { return gfx::Size(INT_MAX, GetHeightForWidth(INT_MAX)); }
diff --git a/ash/assistant/ui/main_stage/assistant_footer_view.h b/ash/assistant/ui/main_stage/assistant_footer_view.h index 0f9604e3..1863d855 100644 --- a/ash/assistant/ui/main_stage/assistant_footer_view.h +++ b/ash/assistant/ui/main_stage/assistant_footer_view.h
@@ -6,6 +6,7 @@ #define ASH_ASSISTANT_UI_MAIN_STAGE_ASSISTANT_FOOTER_VIEW_H_ #include <memory> +#include <string> #include "ash/public/interfaces/voice_interaction_controller.mojom.h" #include "base/macros.h" @@ -29,6 +30,7 @@ ~AssistantFooterView() override; // views::View: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override;
diff --git a/ash/assistant/ui/main_stage/assistant_header_view.cc b/ash/assistant/ui/main_stage/assistant_header_view.cc index 705a341..8eb7d3e 100644 --- a/ash/assistant/ui/main_stage/assistant_header_view.cc +++ b/ash/assistant/ui/main_stage/assistant_header_view.cc
@@ -67,6 +67,10 @@ assistant_controller_->interaction_controller()->RemoveModelObserver(this); } +const char* AssistantHeaderView::GetClassName() const { + return "AssistantHeaderView"; +} + gfx::Size AssistantHeaderView::CalculatePreferredSize() const { return gfx::Size(INT_MAX, GetHeightForWidth(INT_MAX)); }
diff --git a/ash/assistant/ui/main_stage/assistant_header_view.h b/ash/assistant/ui/main_stage/assistant_header_view.h index a159dab..8eff87d 100644 --- a/ash/assistant/ui/main_stage/assistant_header_view.h +++ b/ash/assistant/ui/main_stage/assistant_header_view.h
@@ -29,6 +29,7 @@ ~AssistantHeaderView() override; // views::View: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; void ChildVisibilityChanged(views::View* child) override;
diff --git a/ash/assistant/ui/main_stage/assistant_main_stage.cc b/ash/assistant/ui/main_stage/assistant_main_stage.cc index f9a9048..dec2e85 100644 --- a/ash/assistant/ui/main_stage/assistant_main_stage.cc +++ b/ash/assistant/ui/main_stage/assistant_main_stage.cc
@@ -226,6 +226,10 @@ assistant_controller_->interaction_controller()->RemoveModelObserver(this); } +const char* AssistantMainStage::GetClassName() const { + return "AssistantMainStage"; +} + void AssistantMainStage::ChildPreferredSizeChanged(views::View* child) { PreferredSizeChanged(); }
diff --git a/ash/assistant/ui/main_stage/assistant_main_stage.h b/ash/assistant/ui/main_stage/assistant_main_stage.h index a34a4bc..db20259f 100644 --- a/ash/assistant/ui/main_stage/assistant_main_stage.h +++ b/ash/assistant/ui/main_stage/assistant_main_stage.h
@@ -42,6 +42,7 @@ ~AssistantMainStage() override; // views::View: + const char* GetClassName() const override; void ChildPreferredSizeChanged(views::View* child) override; void ChildVisibilityChanged(views::View* child) override;
diff --git a/ash/assistant/ui/main_stage/assistant_opt_in_view.cc b/ash/assistant/ui/main_stage/assistant_opt_in_view.cc index b8f584457..a3180dd 100644 --- a/ash/assistant/ui/main_stage/assistant_opt_in_view.cc +++ b/ash/assistant/ui/main_stage/assistant_opt_in_view.cc
@@ -83,6 +83,10 @@ AssistantOptInView::~AssistantOptInView() = default; +const char* AssistantOptInView::GetClassName() const { + return "AssistantOptInView"; +} + void AssistantOptInView::ChildPreferredSizeChanged(views::View* child) { PreferredSizeChanged(); }
diff --git a/ash/assistant/ui/main_stage/assistant_opt_in_view.h b/ash/assistant/ui/main_stage/assistant_opt_in_view.h index 431351a..239fbe7 100644 --- a/ash/assistant/ui/main_stage/assistant_opt_in_view.h +++ b/ash/assistant/ui/main_stage/assistant_opt_in_view.h
@@ -32,7 +32,8 @@ AssistantOptInView(); ~AssistantOptInView() override; - // views::Button: + // views::View: + const char* GetClassName() const override; void ChildPreferredSizeChanged(views::View* child) override; void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
diff --git a/ash/assistant/ui/main_stage/assistant_progress_indicator.cc b/ash/assistant/ui/main_stage/assistant_progress_indicator.cc index 0fe8546e..c2012ce 100644 --- a/ash/assistant/ui/main_stage/assistant_progress_indicator.cc +++ b/ash/assistant/ui/main_stage/assistant_progress_indicator.cc
@@ -4,6 +4,8 @@ #include "ash/assistant/ui/main_stage/assistant_progress_indicator.h" +#include <algorithm> + #include "ash/assistant/util/animation_util.h" #include "base/bind.h" #include "base/time/time.h" @@ -89,6 +91,10 @@ } } +const char* AssistantProgressIndicator::GetClassName() const { + return "AssistantProgressIndicator"; +} + void AssistantProgressIndicator::AddedToWidget() { VisibilityChanged(/*starting_from=*/this, /*is_visible=*/visible()); } @@ -118,7 +124,8 @@ return; } - using namespace assistant::util; + using assistant::util::CreateLayerAnimationSequence; + using assistant::util::CreateTransformElement; // The animation performs scaling on the child views. In order to give the // illusion that scaling is being performed about the center of the view as @@ -154,4 +161,4 @@ } } -} // namespace ash \ No newline at end of file +} // namespace ash
diff --git a/ash/assistant/ui/main_stage/assistant_progress_indicator.h b/ash/assistant/ui/main_stage/assistant_progress_indicator.h index a54e2e4..ee92b30 100644 --- a/ash/assistant/ui/main_stage/assistant_progress_indicator.h +++ b/ash/assistant/ui/main_stage/assistant_progress_indicator.h
@@ -18,6 +18,7 @@ ~AssistantProgressIndicator() override; // views::View: + const char* GetClassName() const override; void AddedToWidget() override; void RemovedFromWidget() override; void OnLayerOpacityChanged(ui::PropertyChangeReason reason) override;
diff --git a/ash/assistant/ui/main_stage/assistant_query_view.cc b/ash/assistant/ui/main_stage/assistant_query_view.cc index 531a5a9..cd89944c 100644 --- a/ash/assistant/ui/main_stage/assistant_query_view.cc +++ b/ash/assistant/ui/main_stage/assistant_query_view.cc
@@ -4,6 +4,7 @@ #include "ash/assistant/ui/main_stage/assistant_query_view.h" +#include <algorithm> #include <memory> #include "ash/assistant/model/assistant_query.h" @@ -40,6 +41,10 @@ AssistantQueryView::~AssistantQueryView() = default; +const char* AssistantQueryView::GetClassName() const { + return "AssistantQueryView"; +} + gfx::Size AssistantQueryView::CalculatePreferredSize() const { return gfx::Size(kMaxWidthDip, GetHeightForWidth(kMaxWidthDip)); }
diff --git a/ash/assistant/ui/main_stage/assistant_query_view.h b/ash/assistant/ui/main_stage/assistant_query_view.h index 31d94a6..816ddf9 100644 --- a/ash/assistant/ui/main_stage/assistant_query_view.h +++ b/ash/assistant/ui/main_stage/assistant_query_view.h
@@ -5,6 +5,8 @@ #ifndef ASH_ASSISTANT_UI_MAIN_STAGE_ASSISTANT_QUERY_VIEW_H_ #define ASH_ASSISTANT_UI_MAIN_STAGE_ASSISTANT_QUERY_VIEW_H_ +#include <string> + #include "base/macros.h" #include "ui/views/controls/styled_label.h" #include "ui/views/view.h" @@ -21,6 +23,7 @@ ~AssistantQueryView() override; // views::View: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override; void ChildPreferredSizeChanged(views::View* child) override;
diff --git a/ash/assistant/ui/main_stage/assistant_text_element_view.cc b/ash/assistant/ui/main_stage/assistant_text_element_view.cc index a506327..922a439 100644 --- a/ash/assistant/ui/main_stage/assistant_text_element_view.cc +++ b/ash/assistant/ui/main_stage/assistant_text_element_view.cc
@@ -26,4 +26,8 @@ AssistantTextElementView::~AssistantTextElementView() = default; +const char* AssistantTextElementView::GetClassName() const { + return "AssistantTextElementView"; +} + } // namespace ash
diff --git a/ash/assistant/ui/main_stage/assistant_text_element_view.h b/ash/assistant/ui/main_stage/assistant_text_element_view.h index 4f3beab..393f8b9bc 100644 --- a/ash/assistant/ui/main_stage/assistant_text_element_view.h +++ b/ash/assistant/ui/main_stage/assistant_text_element_view.h
@@ -19,6 +19,9 @@ explicit AssistantTextElementView(const AssistantTextElement* text_element); ~AssistantTextElementView() override; + // views::Label: + const char* GetClassName() const override; + private: DISALLOW_COPY_AND_ASSIGN(AssistantTextElementView); };
diff --git a/ash/assistant/ui/main_stage/suggestion_container_view.cc b/ash/assistant/ui/main_stage/suggestion_container_view.cc index 8e936af..93d1aebd 100644 --- a/ash/assistant/ui/main_stage/suggestion_container_view.cc +++ b/ash/assistant/ui/main_stage/suggestion_container_view.cc
@@ -48,6 +48,10 @@ assistant_controller_->cache_controller()->RemoveModelObserver(this); } +const char* SuggestionContainerView::GetClassName() const { + return "SuggestionContainerView"; +} + gfx::Size SuggestionContainerView::CalculatePreferredSize() const { return gfx::Size(INT_MAX, GetHeightForWidth(INT_MAX)); }
diff --git a/ash/assistant/ui/main_stage/suggestion_container_view.h b/ash/assistant/ui/main_stage/suggestion_container_view.h index 10a979e..1963814 100644 --- a/ash/assistant/ui/main_stage/suggestion_container_view.h +++ b/ash/assistant/ui/main_stage/suggestion_container_view.h
@@ -41,6 +41,7 @@ ~SuggestionContainerView() override; // AssistantScrollView: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override; void OnContentsPreferredSizeChanged(views::View* content_view) override;
diff --git a/ash/assistant/ui/main_stage/ui_element_container_view.cc b/ash/assistant/ui/main_stage/ui_element_container_view.cc index ef22b66..42bb7e3 100644 --- a/ash/assistant/ui/main_stage/ui_element_container_view.cc +++ b/ash/assistant/ui/main_stage/ui_element_container_view.cc
@@ -231,6 +231,10 @@ ReleaseAllCards(); } +const char* UiElementContainerView::GetClassName() const { + return "UiElementContainerView"; +} + gfx::Size UiElementContainerView::CalculatePreferredSize() const { return gfx::Size(INT_MAX, GetHeightForWidth(INT_MAX)); }
diff --git a/ash/assistant/ui/main_stage/ui_element_container_view.h b/ash/assistant/ui/main_stage/ui_element_container_view.h index dd93559..03382e5 100644 --- a/ash/assistant/ui/main_stage/ui_element_container_view.h +++ b/ash/assistant/ui/main_stage/ui_element_container_view.h
@@ -38,6 +38,7 @@ ~UiElementContainerView() override; // AssistantScrollView: + const char* GetClassName() const override; gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override; void OnContentsPreferredSizeChanged(views::View* content_view) override;
diff --git a/ash/display/resolution_notification_controller.cc b/ash/display/resolution_notification_controller.cc index 4b231d02..1a1fadd 100644 --- a/ash/display/resolution_notification_controller.cc +++ b/ash/display/resolution_notification_controller.cc
@@ -285,19 +285,12 @@ CreateOrUpdateNotification(false); } -void ResolutionNotificationController::OnDisplayAdded( - const display::Display& new_display) {} - void ResolutionNotificationController::OnDisplayRemoved( const display::Display& old_display) { if (change_info_ && change_info_->display_id == old_display.id()) RevertResolutionChange(true /* display_was_removed */); } -void ResolutionNotificationController::OnDisplayMetricsChanged( - const display::Display&, - uint32_t) {} - void ResolutionNotificationController::OnDisplayConfigurationChanged() { if (!change_info_) return;
diff --git a/ash/display/resolution_notification_controller.h b/ash/display/resolution_notification_controller.h index 523d24f..6763090 100644 --- a/ash/display/resolution_notification_controller.h +++ b/ash/display/resolution_notification_controller.h
@@ -98,10 +98,7 @@ void OnTimerTick(); // display::DisplayObserver overrides: - void OnDisplayAdded(const display::Display& new_display) override; void OnDisplayRemoved(const display::Display& old_display) override; - void OnDisplayMetricsChanged(const display::Display& display, - uint32_t metrics) override; // WindowTreeHostManager::Observer overrides: void OnDisplayConfigurationChanged() override;
diff --git a/ash/display/window_tree_host_manager_unittest.cc b/ash/display/window_tree_host_manager_unittest.cc index 2b09ef5..6a38208b 100644 --- a/ash/display/window_tree_host_manager_unittest.cc +++ b/ash/display/window_tree_host_manager_unittest.cc
@@ -102,8 +102,6 @@ if (metrics & DISPLAY_METRIC_PRIMARY) ++primary_changed_count_; } - void OnDisplayAdded(const display::Display& new_display) override {} - void OnDisplayRemoved(const display::Display& old_display) override {} // Overridden from aura::client::FocusChangeObserver void OnWindowFocused(aura::Window* gained_focus,
diff --git a/ash/message_center/message_center_bubble.cc b/ash/message_center/message_center_bubble.cc index 0959c5c..a21ea01 100644 --- a/ash/message_center/message_center_bubble.cc +++ b/ash/message_center/message_center_bubble.cc
@@ -113,7 +113,6 @@ message_center_view_ = new MessageCenterView(message_center_, max_height_); bubble_view_->AddChildView(new ContentsView(this, message_center_view_)); message_center_view_->SetMaxHeight(max_height_); - message_center_view_->Init(); // Resize the content of the bubble view to the given bubble size. This is // necessary in case of the bubble border forcing a bigger size then the // |new_bubble_view| actually wants. See crbug.com/169390.
diff --git a/ash/message_center/message_center_view.cc b/ash/message_center/message_center_view.cc index ad1f2414..7db7e1c 100644 --- a/ash/message_center/message_center_view.cc +++ b/ash/message_center/message_center_view.cc
@@ -249,15 +249,6 @@ if (!is_closing_) message_center_->RemoveObserver(this); - - if (focus_manager_) - focus_manager_->RemoveFocusChangeListener(this); -} - -void MessageCenterView::Init() { - focus_manager_ = GetFocusManager(); - if (focus_manager_) - focus_manager_->AddFocusChangeListener(this); } void MessageCenterView::SetNotifications( @@ -336,26 +327,6 @@ message_center_->AddObserver(this); } -void MessageCenterView::OnDidChangeFocus(views::View* before, - views::View* now) { - // Update the button visibility when the focus state is changed. - size_t count = message_list_view_->GetNotificationCount(); - for (size_t i = 0; i < count; ++i) { - MessageView* view = message_list_view_->GetNotificationAt(i); - // ControlButtonsView is not in the same view hierarchy on ARC++ - // notifications, so check it separately. - if (view->Contains(before) || view->Contains(now) || - (view->GetControlButtonsView() && - (view->GetControlButtonsView()->Contains(before) || - view->GetControlButtonsView()->Contains(now)))) { - view->UpdateControlButtonsVisibility(); - } - - // Ensure that a notification is not removed or added during iteration. - DCHECK_EQ(count, message_list_view_->GetNotificationCount()); - } -} - void MessageCenterView::UpdateScrollerShadowVisibility() { // |scroller_shadow_| is visible only if |scroller_| is not all scrolled. scroller_shadow_->SetVisible(scroller_->contents()->height() +
diff --git a/ash/message_center/message_center_view.h b/ash/message_center/message_center_view.h index c753cbc..0285b9d 100644 --- a/ash/message_center/message_center_view.h +++ b/ash/message_center/message_center_view.h
@@ -44,15 +44,12 @@ public SessionObserver, public MessageListView::Observer, public gfx::AnimationDelegate, - public views::FocusChangeListener, public views::ViewObserver { public: MessageCenterView(message_center::MessageCenter* message_center, int max_height); ~MessageCenterView() override; - void Init(); - void SetNotifications( const message_center::NotificationList::Notifications& notifications); @@ -68,10 +65,6 @@ void SetMaxHeight(int max_height) { max_height_ = max_height; } - // Overridden from views::FocusChangeListener - void OnWillChangeFocus(views::View* before, views::View* now) override {} - void OnDidChangeFocus(views::View* before, views::View* now) override; - void UpdateScrollerShadowVisibility(); static const size_t kMaxVisibleNotifications; @@ -181,8 +174,6 @@ // Current view mode. During animation, it is the target mode. Mode mode_ = Mode::NO_NOTIFICATIONS; - views::FocusManager* focus_manager_ = nullptr; - ScopedSessionObserver session_observer_{this}; DISALLOW_COPY_AND_ASSIGN(MessageCenterView);
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index 571cef4..d296478 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc
@@ -80,8 +80,6 @@ FocusCycler* focus_cycler() { return focus_cycler_; } - ui::Layer* opaque_background() { return &opaque_background_; } - void SetParentLayer(ui::Layer* layer); void set_default_last_focusable_child(bool default_last_focusable_child) { @@ -131,6 +129,8 @@ SetLayoutManager(std::make_unique<views::FillLayout>()); set_allow_deactivate_on_esc(true); + if (shelf_widget_->shelf_layout_manager()->IsBackgroundBlurEnabled()) + opaque_background_.SetBackgroundBlur(kShelfBlurRadius); UpdateOpaqueBackground(); } @@ -217,8 +217,6 @@ mask_ = views::Painter::CreatePaintedLayer( views::Painter::CreateSolidRoundRectPainter(SK_ColorBLACK, radius)); mask_->layer()->SetBounds(opaque_background_bounds); - if (shelf_widget_->shelf_layout_manager()->IsBackgroundBlurEnabled()) - opaque_background_.SetBackgroundBlur(kShelfBlurRadius); opaque_background_.SetMaskLayer(mask_->layer()); } }
diff --git a/ash/system/message_center/arc/arc_notification_content_view.cc b/ash/system/message_center/arc/arc_notification_content_view.cc index df73e23..4cfef65 100644 --- a/ash/system/message_center/arc/arc_notification_content_view.cc +++ b/ash/system/message_center/arc/arc_notification_content_view.cc
@@ -104,6 +104,7 @@ widget->OnMouseEvent(located_event->AsMouseEvent()); } else if (located_event->IsScrollEvent()) { widget->OnScrollEvent(located_event->AsScrollEvent()); + owner_->item_->CancelLongPress(); } else if (located_event->IsGestureEvent() && event->type() != ui::ET_GESTURE_TAP) { bool slide_handled_by_android = false;
diff --git a/ash/system/message_center/ash_popup_alignment_delegate.cc b/ash/system/message_center/ash_popup_alignment_delegate.cc index 49de6d0..5101045 100644 --- a/ash/system/message_center/ash_popup_alignment_delegate.cc +++ b/ash/system/message_center/ash_popup_alignment_delegate.cc
@@ -162,12 +162,6 @@ /////////////////////////////////////////////////////////////////////////////// // display::DisplayObserver: -void AshPopupAlignmentDelegate::OnDisplayAdded( - const display::Display& new_display) {} - -void AshPopupAlignmentDelegate::OnDisplayRemoved( - const display::Display& old_display) {} - void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( const display::Display& display, uint32_t metrics) {
diff --git a/ash/system/message_center/ash_popup_alignment_delegate.h b/ash/system/message_center/ash_popup_alignment_delegate.h index 060d9e0..c08c39f 100644 --- a/ash/system/message_center/ash_popup_alignment_delegate.h +++ b/ash/system/message_center/ash_popup_alignment_delegate.h
@@ -77,8 +77,6 @@ void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; // Overridden from display::DisplayObserver: - void OnDisplayAdded(const display::Display& new_display) override; - void OnDisplayRemoved(const display::Display& old_display) override; void OnDisplayMetricsChanged(const display::Display& display, uint32_t metrics) override;
diff --git a/ash/system/unified/unified_message_center_view.cc b/ash/system/unified/unified_message_center_view.cc index 87ba62b..02fd7fc 100644 --- a/ash/system/unified/unified_message_center_view.cc +++ b/ash/system/unified/unified_message_center_view.cc
@@ -139,11 +139,17 @@ UnifiedMessageCenterView::~UnifiedMessageCenterView() { message_center_->RemoveObserver(this); - if (focus_manager_) - focus_manager_->RemoveFocusChangeListener(this); + RemovedFromWidget(); } -void UnifiedMessageCenterView::Init() { +void UnifiedMessageCenterView::RemovedFromWidget() { + if (!focus_manager_) + return; + focus_manager_->RemoveFocusChangeListener(this); + focus_manager_ = nullptr; +} + +void UnifiedMessageCenterView::AddedToWidget() { focus_manager_ = GetFocusManager(); if (focus_manager_) focus_manager_->AddFocusChangeListener(this); @@ -278,22 +284,6 @@ void UnifiedMessageCenterView::OnDidChangeFocus(views::View* before, views::View* now) { - // Update the button visibility when the focus state is changed. - size_t count = message_list_view_->GetNotificationCount(); - for (size_t i = 0; i < count; ++i) { - MessageView* view = message_list_view_->GetNotificationAt(i); - // ControlButtonsView is not in the same view hierarchy on ARC++ - // notifications, so check it separately. - if (view->Contains(before) || view->Contains(now) || - (view->GetControlButtonsView() && - (view->GetControlButtonsView()->Contains(before) || - view->GetControlButtonsView()->Contains(now)))) { - view->UpdateControlButtonsVisibility(); - } - - // Ensure that a notification is not removed or added during iteration. - DCHECK_EQ(count, message_list_view_->GetNotificationCount()); - } OnMessageCenterScrolled(); }
diff --git a/ash/system/unified/unified_message_center_view.h b/ash/system/unified/unified_message_center_view.h index 3adb8a7..b6ca272 100644 --- a/ash/system/unified/unified_message_center_view.h +++ b/ash/system/unified/unified_message_center_view.h
@@ -24,12 +24,6 @@ } // namespace message_center -namespace views { - -class FocusManager; - -} // namespace views - namespace ash { class UnifiedSystemTrayController; @@ -67,9 +61,6 @@ message_center::MessageCenter* message_center); ~UnifiedMessageCenterView() override; - // Initialize focus listener. - void Init(); - // Set the maximum height that the view can take. void SetMaxHeight(int max_height); @@ -85,6 +76,8 @@ // views::View: void Layout() override; gfx::Size CalculatePreferredSize() const override; + void RemovedFromWidget() override; + void AddedToWidget() override; // message_center::MessageCenterObserver: void OnNotificationAdded(const std::string& id) override;
diff --git a/ash/system/unified/unified_system_tray_bubble.cc b/ash/system/unified/unified_system_tray_bubble.cc index 23ce2c5..1511aa98 100644 --- a/ash/system/unified/unified_system_tray_bubble.cc +++ b/ash/system/unified/unified_system_tray_bubble.cc
@@ -112,7 +112,6 @@ TrayBackgroundView::InitializeBubbleAnimations(bubble_widget_); bubble_view_->InitializeAndShowBubble(); - unified_view_->Init(); if (app_list::features::IsBackgroundBlurEnabled()) { bubble_widget_->client_view()->layer()->SetBackgroundBlur(
diff --git a/ash/system/unified/unified_system_tray_view.cc b/ash/system/unified/unified_system_tray_view.cc index a050aec..d9d1d29b 100644 --- a/ash/system/unified/unified_system_tray_view.cc +++ b/ash/system/unified/unified_system_tray_view.cc
@@ -273,10 +273,6 @@ UnifiedSystemTrayView::~UnifiedSystemTrayView() = default; -void UnifiedSystemTrayView::Init() { - message_center_view_->Init(); -} - void UnifiedSystemTrayView::SetMaxHeight(int max_height) { message_center_view_->SetMaxHeight(max_height); }
diff --git a/ash/system/unified/unified_system_tray_view.h b/ash/system/unified/unified_system_tray_view.h index 250e859..33a8311 100644 --- a/ash/system/unified/unified_system_tray_view.h +++ b/ash/system/unified/unified_system_tray_view.h
@@ -54,9 +54,6 @@ bool initially_expanded); ~UnifiedSystemTrayView() override; - // Initialize after the view is attached to the widget. - void Init(); - // Set the maximum height that the view can take. void SetMaxHeight(int max_height);
diff --git a/ash/system/virtual_keyboard/virtual_keyboard_tray.cc b/ash/system/virtual_keyboard/virtual_keyboard_tray.cc index 259557e..7dbb218 100644 --- a/ash/system/virtual_keyboard/virtual_keyboard_tray.cc +++ b/ash/system/virtual_keyboard/virtual_keyboard_tray.cc
@@ -132,6 +132,8 @@ icon, TrayIconColor(Shell::Get()->session_controller()->GetSessionState())); icon_->SetImage(image); + icon_->SetTooltipText(l10n_util::GetStringUTF16( + IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD)); const int vertical_padding = (kTrayItemSize - image.height()) / 2; const int horizontal_padding = (kTrayItemSize - image.width()) / 2; icon_->SetBorder(views::CreateEmptyBorder(
diff --git a/ash/touch/touch_observer_hud.cc b/ash/touch/touch_observer_hud.cc index ed3fc0a..41f4342 100644 --- a/ash/touch/touch_observer_hud.cc +++ b/ash/touch/touch_observer_hud.cc
@@ -443,8 +443,6 @@ delete this; } -void TouchObserverHUD::OnDisplayAdded(const display::Display& new_display) {} - void TouchObserverHUD::OnDisplayRemoved(const display::Display& old_display) { if (old_display.id() != display_id_) return;
diff --git a/ash/touch/touch_observer_hud.h b/ash/touch/touch_observer_hud.h index d92805b..f6bb30bf 100644 --- a/ash/touch/touch_observer_hud.h +++ b/ash/touch/touch_observer_hud.h
@@ -73,7 +73,6 @@ void OnWidgetDestroying(views::Widget* widget) override; // display::DisplayObserver: - void OnDisplayAdded(const display::Display& new_display) override; void OnDisplayRemoved(const display::Display& old_display) override; void OnDisplayMetricsChanged(const display::Display& display, uint32_t metrics) override;
diff --git a/ash/wm/tablet_mode/tablet_mode_window_manager.cc b/ash/wm/tablet_mode/tablet_mode_window_manager.cc index dc8c074..8269293 100644 --- a/ash/wm/tablet_mode/tablet_mode_window_manager.cc +++ b/ash/wm/tablet_mode/tablet_mode_window_manager.cc
@@ -206,11 +206,6 @@ DisplayConfigurationChanged(); } -void TabletModeWindowManager::OnDisplayMetricsChanged(const display::Display&, - uint32_t) { - // Nothing to do here. -} - void TabletModeWindowManager::OnSplitViewStateChanged( SplitViewController::State previous_state, SplitViewController::State state) {
diff --git a/ash/wm/tablet_mode/tablet_mode_window_manager.h b/ash/wm/tablet_mode/tablet_mode_window_manager.h index 0bca088..aeb12f5 100644 --- a/ash/wm/tablet_mode/tablet_mode_window_manager.h +++ b/ash/wm/tablet_mode/tablet_mode_window_manager.h
@@ -77,8 +77,6 @@ // display::DisplayObserver: void OnDisplayAdded(const display::Display& display) override; void OnDisplayRemoved(const display::Display& display) override; - void OnDisplayMetricsChanged(const display::Display& display, - uint32_t metrics) override; // SplitViewController::Observer: void OnSplitViewStateChanged(SplitViewController::State previous_state,
diff --git a/ash/wm/window_cycle_list.cc b/ash/wm/window_cycle_list.cc index db78c73..bbae875 100644 --- a/ash/wm/window_cycle_list.cc +++ b/ash/wm/window_cycle_list.cc
@@ -500,10 +500,6 @@ } } -void WindowCycleList::OnDisplayAdded(const display::Display& new_display) {} - -void WindowCycleList::OnDisplayRemoved(const display::Display& old_display) {} - void WindowCycleList::OnDisplayMetricsChanged(const display::Display& display, uint32_t changed_metrics) { if (cycle_ui_widget_ &&
diff --git a/ash/wm/window_cycle_list.h b/ash/wm/window_cycle_list.h index 7f7eade1..6c9ae9f 100644 --- a/ash/wm/window_cycle_list.h +++ b/ash/wm/window_cycle_list.h
@@ -68,8 +68,6 @@ void OnWindowDestroying(aura::Window* window) override; // display::DisplayObserver overrides: - void OnDisplayAdded(const display::Display& new_display) override; - void OnDisplayRemoved(const display::Display& old_display) override; void OnDisplayMetricsChanged(const display::Display& display, uint32_t changed_metrics) override;
diff --git a/base/memory/aligned_memory.h b/base/memory/aligned_memory.h index 89f9505..a242b73 100644 --- a/base/memory/aligned_memory.h +++ b/base/memory/aligned_memory.h
@@ -34,7 +34,9 @@ namespace base { -// This can be replaced with std::aligned_malloc when we have C++17. +// This can be replaced with std::aligned_alloc when we have C++17. +// Caveat: std::aligned_alloc requires the size parameter be an integral +// multiple of alignment. BASE_EXPORT void* AlignedAlloc(size_t size, size_t alignment); inline void AlignedFree(void* ptr) {
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc index 8180a55..9352fdd3c 100644 --- a/base/metrics/histogram.cc +++ b/base/metrics/histogram.cc
@@ -184,30 +184,6 @@ DCHECK_EQ(minimum_, registered_ranges->range(1)); DCHECK_EQ(maximum_, registered_ranges->range(bucket_count_ - 1)); -// Temporary check for https://crbug.com/836238 -#if defined(OS_WIN) // Only Windows has a debugger that makes this useful. - if (maximum_ != registered_ranges->range(bucket_count_ - 1)) { - // Create local copies of the parameters to be sure they'll be available - // in the crash dump for the debugger to see. - Sample hash_32 = static_cast<Sample>(HashMetricName(name_)); - debug::Alias(&hash_32); - DEBUG_ALIAS_FOR_CSTR(h_name, name_.c_str(), 100); - HistogramType h_type = histogram_type_; - Sample h_min = minimum_; - Sample h_max = maximum_; - uint32_t h_count = bucket_count_; - debug::Alias(&h_type); - debug::Alias(&h_min); - debug::Alias(&h_max); - debug::Alias(&h_count); - uint32_t ranges_min = registered_ranges->range(1); - uint32_t ranges_max = registered_ranges->range(bucket_count_ - 1); - debug::Alias(&ranges_min); - debug::Alias(&ranges_max); - CHECK(false) << name_; - } -#endif - // Try to create the histogram using a "persistent" allocator. As of // 2016-02-25, the availability of such is controlled by a base::Feature // that is off by default. If the allocator doesn't exist or if
diff --git a/cc/DEPS b/cc/DEPS index ce31053..6f352e8 100644 --- a/cc/DEPS +++ b/cc/DEPS
@@ -8,6 +8,8 @@ "+gpu/command_buffer/client/gles2_interface_stub.h", # for tests "+gpu/command_buffer/client/gpu_memory_buffer_manager.h", "+gpu/command_buffer/client/raster_implementation_gles.h", + "+gpu/command_buffer/client/raster_interface.h", + "+gpu/command_buffer/client/shared_image_interface.h", "+gpu/command_buffer/common/capabilities.h", "+gpu/command_buffer/common/discardable_handle.h", "+gpu/command_buffer/common/gl2_types.h", @@ -15,7 +17,8 @@ "+gpu/command_buffer/common/gpu_memory_buffer_support.h", "+gpu/command_buffer/common/mailbox.h", "+gpu/command_buffer/common/mailbox_holder.h", - "+gpu/command_buffer/client/raster_interface.h", + "+gpu/command_buffer/common/shared_image_trace_utils.h", + "+gpu/command_buffer/common/shared_image_usage.h", "+gpu/command_buffer/common/sync_token.h", "+gpu/command_buffer/common/texture_in_use_response.h", "+gpu/config/gpu_feature_info.h",
diff --git a/cc/raster/gpu_raster_buffer_provider.cc b/cc/raster/gpu_raster_buffer_provider.cc index 3db004cf..a7df553 100644 --- a/cc/raster/gpu_raster_buffer_provider.cc +++ b/cc/raster/gpu_raster_buffer_provider.cc
@@ -8,8 +8,10 @@ #include <algorithm> +#include "base/format_macros.h" #include "base/macros.h" #include "base/metrics/histogram_macros.h" +#include "base/strings/stringprintf.h" #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/trace_event.h" #include "cc/base/histograms.h" @@ -28,13 +30,15 @@ #include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/client/raster_interface.h" +#include "gpu/command_buffer/client/shared_image_interface.h" #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" +#include "gpu/command_buffer/common/shared_image_trace_utils.h" +#include "gpu/command_buffer/common/shared_image_usage.h" #include "third_party/skia/include/core/SkMultiPictureDraw.h" #include "third_party/skia/include/core/SkPictureRecorder.h" #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/GrContext.h" #include "ui/gfx/geometry/axis_transform2d.h" -#include "ui/gl/trace_util.h" #include "url/gurl.h" namespace cc { @@ -114,10 +118,10 @@ static void RasterizeSourceOOP( const RasterSource* raster_source, bool resource_has_previous_content, - const gpu::Mailbox& mailbox, + gpu::Mailbox* mailbox, + const gpu::SyncToken& sync_token, GLenum texture_target, bool texture_is_overlay_candidate, - bool texture_storage_allocated, const gfx::Size& resource_size, viz::ResourceFormat resource_format, const gfx::ColorSpace& color_space, @@ -128,16 +132,22 @@ viz::RasterContextProvider* context_provider, int msaa_sample_count) { gpu::raster::RasterInterface* ri = context_provider->RasterInterface(); + if (mailbox->IsZero()) { + DCHECK(!sync_token.HasData()); + auto* sii = context_provider->SharedImageInterface(); + uint32_t flags = gpu::SHARED_IMAGE_USAGE_RASTER; + if (texture_is_overlay_candidate) + flags |= gpu::SHARED_IMAGE_USAGE_SCANOUT; + *mailbox = sii->CreateSharedImage(resource_format, resource_size, + color_space, flags); + ri->WaitSyncTokenCHROMIUM(sii->GenUnverifiedSyncToken().GetConstData()); + } else { + ri->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); + } + GLuint texture_id = ri->CreateAndConsumeTexture( texture_is_overlay_candidate, gfx::BufferUsage::SCANOUT, resource_format, - mailbox.name); - if (!texture_storage_allocated) { - viz::TextureAllocation alloc = {texture_id, texture_target, - texture_is_overlay_candidate}; - viz::TextureAllocation::AllocateStorage( - ri, context_provider->ContextCapabilities(), resource_format, - resource_size, alloc, color_space); - } + mailbox->name); // TODO(enne): Use the |texture_target|? GpuMemoryBuffer backed textures don't // use GL_TEXTURE_2D. @@ -145,7 +155,7 @@ playback_settings.use_lcd_text, viz::ResourceFormatToClosestSkColorType( /*gpu_compositing=*/true, resource_format), - playback_settings.raster_color_space, mailbox.name); + playback_settings.raster_color_space, mailbox->name); float recording_to_raster_scale = transform.scale() / raster_source->recording_scale_factor(); gfx::Size content_size = raster_source->GetContentSize(transform.scale()); @@ -168,10 +178,10 @@ static void RasterizeSource( const RasterSource* raster_source, bool resource_has_previous_content, - const gpu::Mailbox& mailbox, + gpu::Mailbox* mailbox, + const gpu::SyncToken& sync_token, GLenum texture_target, bool texture_is_overlay_candidate, - bool texture_storage_allocated, const gfx::Size& resource_size, viz::ResourceFormat resource_format, const gfx::ColorSpace& color_space, @@ -184,17 +194,24 @@ bool unpremultiply_and_dither, const gfx::Size& max_tile_size) { gpu::raster::RasterInterface* ri = context_provider->RasterInterface(); + if (mailbox->IsZero()) { + auto* sii = context_provider->SharedImageInterface(); + uint32_t flags = gpu::SHARED_IMAGE_USAGE_GLES2 | + gpu::SHARED_IMAGE_USAGE_GLES2_FRAMEBUFFER_HINT; + if (texture_is_overlay_candidate) + flags |= gpu::SHARED_IMAGE_USAGE_SCANOUT; + *mailbox = sii->CreateSharedImage(resource_format, resource_size, + color_space, flags); + ri->WaitSyncTokenCHROMIUM(sii->GenUnverifiedSyncToken().GetConstData()); + } else { + // Wait on the SyncToken that was created on the compositor thread after + // making the mailbox. This ensures that the mailbox we consume here is + // valid by the time the consume command executes. + ri->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); + } GLuint texture_id = ri->CreateAndConsumeTexture( texture_is_overlay_candidate, gfx::BufferUsage::SCANOUT, resource_format, - mailbox.name); - if (!texture_storage_allocated) { - viz::TextureAllocation alloc = {texture_id, texture_target, - texture_is_overlay_candidate}; - viz::TextureAllocation::AllocateStorage( - ri, context_provider->ContextCapabilities(), resource_format, - resource_size, alloc, color_space); - } - + mailbox->name); { ScopedGrContextAccess gr_context_access(context_provider); base::Optional<viz::ClientResourceProvider::ScopedSkSurface> scoped_surface; @@ -244,13 +261,13 @@ : public ResourcePool::GpuBacking { public: ~GpuRasterBacking() override { - gpu::gles2::GLES2Interface* gl = compositor_context_provider->ContextGL(); + if (mailbox.IsZero()) + return; + auto* sii = worker_context_provider->SharedImageInterface(); if (returned_sync_token.HasData()) - gl->WaitSyncTokenCHROMIUM(returned_sync_token.GetConstData()); - if (mailbox_sync_token.HasData()) - gl->WaitSyncTokenCHROMIUM(mailbox_sync_token.GetConstData()); - if (texture_id) - gl->DeleteTextures(1, &texture_id); + sii->DestroySharedImage(returned_sync_token, mailbox); + else if (mailbox_sync_token.HasData()) + sii->DestroySharedImage(mailbox_sync_token, mailbox); } void OnMemoryDump( @@ -258,23 +275,16 @@ const base::trace_event::MemoryAllocatorDumpGuid& buffer_dump_guid, uint64_t tracing_process_id, int importance) const override { - if (!storage_allocated) + if (mailbox.IsZero()) return; - auto texture_tracing_guid = gl::GetGLTextureClientGUIDForTracing( - compositor_context_provider->ContextSupport()->ShareGroupTracingGUID(), - texture_id); - pmd->CreateSharedGlobalAllocatorDump(texture_tracing_guid); - pmd->AddOwnershipEdge(buffer_dump_guid, texture_tracing_guid, importance); + auto tracing_guid = gpu::GetSharedImageGUIDForTracing(mailbox); + pmd->CreateSharedGlobalAllocatorDump(tracing_guid); + pmd->AddOwnershipEdge(buffer_dump_guid, tracing_guid, importance); } - // The ContextProvider used to clean up the texture id. - viz::ContextProvider* compositor_context_provider = nullptr; - // The texture backing of the resource. - GLuint texture_id = 0; - // The allocation of storage for the |texture_id| is deferred, and this tracks - // if it has been done. - bool storage_allocated = false; + // The ContextProvider used to clean up the mailbox + viz::RasterContextProvider* worker_context_provider = nullptr; }; GpuRasterBufferProvider::RasterBufferImpl::RasterBufferImpl( @@ -289,10 +299,9 @@ color_space_(in_use_resource.color_space()), resource_has_previous_content_(resource_has_previous_content), before_raster_sync_token_(backing->returned_sync_token), - mailbox_(backing->mailbox), texture_target_(backing->texture_target), texture_is_overlay_candidate_(backing->overlay_candidate), - texture_storage_allocated_(backing->storage_allocated) {} + mailbox_(backing->mailbox) {} GpuRasterBufferProvider::RasterBufferImpl::~RasterBufferImpl() { // This SyncToken was created on the worker context after rastering the @@ -303,7 +312,7 @@ // happened if the |after_raster_sync_token_| was set. backing_->returned_sync_token = gpu::SyncToken(); } - backing_->storage_allocated = texture_storage_allocated_; + backing_->mailbox = mailbox_; } void GpuRasterBufferProvider::RasterBufferImpl::Playback( @@ -320,12 +329,10 @@ // returns another SyncToken generated on the worker thread to synchronize // with after the raster is complete. after_raster_sync_token_ = client_->PlaybackOnWorkerThread( - mailbox_, texture_target_, texture_is_overlay_candidate_, - texture_storage_allocated_, before_raster_sync_token_, resource_size_, - resource_format_, color_space_, resource_has_previous_content_, - raster_source, raster_full_rect, raster_dirty_rect, new_content_id, - transform, playback_settings, url); - texture_storage_allocated_ = true; + &mailbox_, texture_target_, texture_is_overlay_candidate_, + before_raster_sync_token_, resource_size_, resource_format_, color_space_, + resource_has_previous_content_, raster_source, raster_full_rect, + raster_dirty_rect, new_content_id, transform, playback_settings, url); } GpuRasterBufferProvider::GpuRasterBufferProvider( @@ -359,24 +366,17 @@ uint64_t previous_content_id) { if (!resource.gpu_backing()) { auto backing = std::make_unique<GpuRasterBacking>(); - backing->compositor_context_provider = compositor_context_provider_; - - gpu::gles2::GLES2Interface* gl = compositor_context_provider_->ContextGL(); + backing->worker_context_provider = worker_context_provider_; const auto& caps = compositor_context_provider_->ContextCapabilities(); - - viz::TextureAllocation alloc = viz::TextureAllocation::MakeTextureId( - gl, caps, resource.format(), use_gpu_memory_buffer_resources_, - /*for_framebuffer_attachment=*/true); - backing->texture_id = alloc.texture_id; - backing->texture_target = alloc.texture_target; - backing->overlay_candidate = alloc.overlay_candidate; - gl->ProduceTextureDirectCHROMIUM(backing->texture_id, - backing->mailbox.name); - // Save a sync token in the backing so that we always wait on it even if - // this task is cancelled between being scheduled and running. - backing->returned_sync_token = - viz::ClientResourceProvider::GenerateSyncTokenHelper(gl); - + backing->overlay_candidate = + use_gpu_memory_buffer_resources_ && caps.texture_storage_image && + IsGpuMemoryBufferFormatSupported(resource.format()); + if (backing->overlay_candidate) { + backing->texture_target = gpu::GetBufferTextureTarget( + gfx::BufferUsage::SCANOUT, BufferFormat(resource.format()), caps); + } else { + backing->texture_target = GL_TEXTURE_2D; + } resource.set_gpu_backing(std::move(backing)); } GpuRasterBacking* backing = @@ -454,10 +454,9 @@ } gpu::SyncToken GpuRasterBufferProvider::PlaybackOnWorkerThread( - const gpu::Mailbox& mailbox, + gpu::Mailbox* mailbox, GLenum texture_target, bool texture_is_overlay_candidate, - bool texture_storage_allocated, const gpu::SyncToken& sync_token, const gfx::Size& resource_size, viz::ResourceFormat resource_format, @@ -475,11 +474,6 @@ gpu::raster::RasterInterface* ri = scoped_context.RasterInterface(); DCHECK(ri); - // Wait on the SyncToken that was created on the compositor thread after - // making the mailbox. This ensures that the mailbox we consume here is valid - // by the time the consume command executes. - ri->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); - gfx::Rect playback_rect = raster_full_rect; if (resource_has_previous_content) { playback_rect.Intersect(raster_dirty_rect); @@ -503,15 +497,15 @@ if (enable_oop_rasterization_) { RasterizeSourceOOP(raster_source, resource_has_previous_content, mailbox, - texture_target, texture_is_overlay_candidate, - texture_storage_allocated, resource_size, - resource_format, color_space, raster_full_rect, - playback_rect, transform, playback_settings, - worker_context_provider_, msaa_sample_count_); + sync_token, texture_target, texture_is_overlay_candidate, + resource_size, resource_format, color_space, + raster_full_rect, playback_rect, transform, + playback_settings, worker_context_provider_, + msaa_sample_count_); } else { RasterizeSource( - raster_source, resource_has_previous_content, mailbox, texture_target, - texture_is_overlay_candidate, texture_storage_allocated, resource_size, + raster_source, resource_has_previous_content, mailbox, sync_token, + texture_target, texture_is_overlay_candidate, resource_size, resource_format, color_space, raster_full_rect, playback_rect, transform, playback_settings, worker_context_provider_, msaa_sample_count_,
diff --git a/cc/raster/gpu_raster_buffer_provider.h b/cc/raster/gpu_raster_buffer_provider.h index 54c4fc9..44bc6249 100644 --- a/cc/raster/gpu_raster_buffer_provider.h +++ b/cc/raster/gpu_raster_buffer_provider.h
@@ -49,10 +49,9 @@ void Shutdown() override; gpu::SyncToken PlaybackOnWorkerThread( - const gpu::Mailbox& mailbox, + gpu::Mailbox* mailbox, GLenum texture_target, bool texture_is_overlay_candidate, - bool texture_storage_allocated, const gpu::SyncToken& sync_token, const gfx::Size& resource_size, viz::ResourceFormat resource_format, @@ -97,11 +96,10 @@ const gfx::ColorSpace color_space_; const bool resource_has_previous_content_; const gpu::SyncToken before_raster_sync_token_; - const gpu::Mailbox mailbox_; const GLenum texture_target_; const bool texture_is_overlay_candidate_; - // Set to true once allocation is done in the worker thread. - bool texture_storage_allocated_; + + gpu::Mailbox mailbox_; // A SyncToken to be returned from the worker thread, and waited on before // using the rastered resource. gpu::SyncToken after_raster_sync_token_;
diff --git a/cc/raster/raster_buffer_provider_perftest.cc b/cc/raster/raster_buffer_provider_perftest.cc index 36db4d2..69a2d47 100644 --- a/cc/raster/raster_buffer_provider_perftest.cc +++ b/cc/raster/raster_buffer_provider_perftest.cc
@@ -117,6 +117,12 @@ } return test_context_provider_->GrContext(); } + gpu::SharedImageInterface* SharedImageInterface() override { + if (!test_context_provider_) { + test_context_provider_ = viz::TestContextProvider::Create(); + } + return test_context_provider_->SharedImageInterface(); + } viz::ContextCacheController* CacheController() override { return &cache_controller_; }
diff --git a/cc/raster/task_graph_work_queue_unittest.cc b/cc/raster/task_graph_work_queue_unittest.cc index 123364f..93455db 100644 --- a/cc/raster/task_graph_work_queue_unittest.cc +++ b/cc/raster/task_graph_work_queue_unittest.cc
@@ -4,6 +4,7 @@ #include "cc/raster/task_graph_work_queue.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace cc { @@ -58,5 +59,161 @@ EXPECT_FALSE(work_queue.HasReadyToRunTasks()); } +// Tasks with same priority but in different category. +TEST(TaskGraphWorkQueueTest, TestTaskWithDifferentCategory) { + TaskGraphWorkQueue work_queue; + NamespaceToken token = work_queue.GenerateNamespaceToken(); + + // Create a graph where | task| has dependencies. + TaskGraph graph; + scoped_refptr<FakeTaskImpl> task(new FakeTaskImpl()); + scoped_refptr<FakeTaskImpl> dependency_task1(new FakeTaskImpl()); + scoped_refptr<FakeTaskImpl> dependency_task2(new FakeTaskImpl()); + scoped_refptr<FakeTaskImpl> dependency_task3(new FakeTaskImpl()); + + graph.nodes.push_back(TaskGraph::Node(task.get(), 0u, 0u, 3u)); + graph.nodes.push_back(TaskGraph::Node(dependency_task1.get(), 0u, 0u, 0u)); + graph.nodes.push_back(TaskGraph::Node(dependency_task2.get(), 1u, 0u, 0u)); + graph.nodes.push_back(TaskGraph::Node(dependency_task3.get(), 2u, 0u, 0u)); + + graph.edges.push_back(TaskGraph::Edge(dependency_task1.get(), task.get())); + graph.edges.push_back(TaskGraph::Edge(dependency_task2.get(), task.get())); + graph.edges.push_back(TaskGraph::Edge(dependency_task3.get(), task.get())); + + // Schedule the graph. + work_queue.ScheduleTasks(token, &graph); + + // Run the |dependency_task1|from category 0. + TaskGraphWorkQueue::PrioritizedTask prioritized_dependency_task = + work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), dependency_task1.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_TRUE(work_queue.HasReadyToRunTasks()); + EXPECT_FALSE(work_queue.HasReadyToRunTasksForCategory(0u)); + EXPECT_TRUE(work_queue.HasReadyToRunTasksForCategory(1u)); + EXPECT_TRUE(work_queue.HasReadyToRunTasksForCategory(2u)); + + // Run the |dependency_task2|from category 1. + prioritized_dependency_task = work_queue.GetNextTaskToRun(1u); + EXPECT_EQ(prioritized_dependency_task.task.get(), dependency_task2.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_TRUE(work_queue.HasReadyToRunTasks()); + EXPECT_FALSE(work_queue.HasReadyToRunTasksForCategory(0u)); + EXPECT_FALSE(work_queue.HasReadyToRunTasksForCategory(1u)); + EXPECT_TRUE(work_queue.HasReadyToRunTasksForCategory(2u)); + + // Run the |dependency_task3|from category 2. + prioritized_dependency_task = work_queue.GetNextTaskToRun(2u); + EXPECT_EQ(prioritized_dependency_task.task.get(), dependency_task3.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_TRUE(work_queue.HasReadyToRunTasks()); + // Once all dependencies from different category completed, | task| turns + // ready to run. + EXPECT_TRUE(work_queue.HasReadyToRunTasksForCategory(0u)); + EXPECT_FALSE(work_queue.HasReadyToRunTasksForCategory(1u)); + EXPECT_FALSE(work_queue.HasReadyToRunTasksForCategory(2u)); + + prioritized_dependency_task = work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), task.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_FALSE(work_queue.HasReadyToRunTasks()); +} + +// Tasks with different priority run in a priority order. But need to guarantee +// its dependences are completed. +TEST(TaskGraphWorkQueueTest, TestTaskWithDifferentPriority) { + TaskGraphWorkQueue work_queue; + NamespaceToken token = work_queue.GenerateNamespaceToken(); + { + // Create a graph where task has a dependency + TaskGraph graph; + scoped_refptr<FakeTaskImpl> task(new FakeTaskImpl()); + scoped_refptr<FakeTaskImpl> dependency_task1(new FakeTaskImpl()); + scoped_refptr<FakeTaskImpl> dependency_task2(new FakeTaskImpl()); + scoped_refptr<FakeTaskImpl> dependency_task3(new FakeTaskImpl()); + + // | task| has the lowest priority and 3 dependences, will run last. + graph.nodes.push_back(TaskGraph::Node(task.get(), 0u, 2u, 3u)); + graph.nodes.push_back(TaskGraph::Node(dependency_task1.get(), 0u, 3u, 0u)); + graph.nodes.push_back(TaskGraph::Node(dependency_task2.get(), 0u, 2u, 0u)); + graph.nodes.push_back(TaskGraph::Node(dependency_task3.get(), 0u, 1u, 0u)); + + graph.edges.push_back(TaskGraph::Edge(dependency_task1.get(), task.get())); + graph.edges.push_back(TaskGraph::Edge(dependency_task2.get(), task.get())); + graph.edges.push_back(TaskGraph::Edge(dependency_task3.get(), task.get())); + + // Schedule the graph. + work_queue.ScheduleTasks(token, &graph); + + // Run the |dependency_task| + TaskGraphWorkQueue::PrioritizedTask prioritized_dependency_task = + work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), dependency_task3.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_TRUE(work_queue.HasReadyToRunTasks()); + + prioritized_dependency_task = work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), dependency_task2.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_TRUE(work_queue.HasReadyToRunTasks()); + + prioritized_dependency_task = work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), dependency_task1.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_TRUE(work_queue.HasReadyToRunTasks()); + + // | task| runs last. + prioritized_dependency_task = work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), task.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_FALSE(work_queue.HasReadyToRunTasks()); + } + + { + // Create a graph where task has dependencies + TaskGraph graph; + scoped_refptr<FakeTaskImpl> task(new FakeTaskImpl()); + scoped_refptr<FakeTaskImpl> dependency_task1(new FakeTaskImpl()); + scoped_refptr<FakeTaskImpl> dependency_task2(new FakeTaskImpl()); + scoped_refptr<FakeTaskImpl> dependency_task3(new FakeTaskImpl()); + + // | task| has the highest priority and 3 dependences, also will run last. + graph.nodes.push_back(TaskGraph::Node(task.get(), 0u, 0u, 3u)); + graph.nodes.push_back(TaskGraph::Node(dependency_task1.get(), 0u, 3u, 0u)); + graph.nodes.push_back(TaskGraph::Node(dependency_task2.get(), 0u, 2u, 0u)); + graph.nodes.push_back(TaskGraph::Node(dependency_task3.get(), 0u, 1u, 0u)); + + graph.edges.push_back(TaskGraph::Edge(dependency_task1.get(), task.get())); + graph.edges.push_back(TaskGraph::Edge(dependency_task2.get(), task.get())); + graph.edges.push_back(TaskGraph::Edge(dependency_task3.get(), task.get())); + + // Schedule the graph. + work_queue.ScheduleTasks(token, &graph); + + // Run the |dependency_task| + TaskGraphWorkQueue::PrioritizedTask prioritized_dependency_task = + work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), dependency_task3.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_TRUE(work_queue.HasReadyToRunTasks()); + + prioritized_dependency_task = work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), dependency_task2.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_TRUE(work_queue.HasReadyToRunTasks()); + + prioritized_dependency_task = work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), dependency_task1.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_TRUE(work_queue.HasReadyToRunTasks()); + + // | task| runs last. + prioritized_dependency_task = work_queue.GetNextTaskToRun(0u); + EXPECT_EQ(prioritized_dependency_task.task.get(), task.get()); + work_queue.CompleteTask(std::move(prioritized_dependency_task)); + EXPECT_FALSE(work_queue.HasReadyToRunTasks()); + } +} + } // namespace } // namespace cc
diff --git a/cc/test/test_in_process_context_provider.cc b/cc/test/test_in_process_context_provider.cc index c3742164..8288b859 100644 --- a/cc/test/test_in_process_context_provider.cc +++ b/cc/test/test_in_process_context_provider.cc
@@ -162,6 +162,15 @@ return gr_context_->get(); } +gpu::SharedImageInterface* +TestInProcessContextProvider::SharedImageInterface() { + if (gles2_context_) { + return gles2_context_->GetSharedImageInterface(); + } else { + return raster_context_->GetSharedImageInterface(); + } +} + viz::ContextCacheController* TestInProcessContextProvider::CacheController() { return cache_controller_.get(); }
diff --git a/cc/test/test_in_process_context_provider.h b/cc/test/test_in_process_context_provider.h index 95e94a8..a7e0b02b 100644 --- a/cc/test/test_in_process_context_provider.h +++ b/cc/test/test_in_process_context_provider.h
@@ -56,6 +56,7 @@ gpu::raster::RasterInterface* RasterInterface() override; gpu::ContextSupport* ContextSupport() override; class GrContext* GrContext() override; + gpu::SharedImageInterface* SharedImageInterface() override; viz::ContextCacheController* CacheController() override; base::Lock* GetLock() override; const gpu::Capabilities& ContextCapabilities() const override;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 4669b378..22d4f9f 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -19,7 +19,6 @@ #include "base/compiler_specific.h" #include "base/containers/adapters.h" #include "base/containers/flat_map.h" -#include "base/debug/dump_without_crashing.h" #include "base/json/json_writer.h" #include "base/memory/memory_coordinator_client_registry.h" #include "base/memory/ptr_util.h" @@ -3836,14 +3835,14 @@ scroll_status.thread = SCROLL_IGNORED; scroll_status.main_thread_scrolling_reasons = MainThreadScrollingReason::kNotScrollable; - // Dump without crashing to debug https://crbug.com/797708, based on the + // Adding NOTREACHED to debug https://crbug.com/797708, based on the // traces on the bug scrolling gets stuck in a situation where the // layout_tree_host_impl assumes that there is an ongoing scroll animation // since scroll_node exists but the // ScrollOffsetAnimationsImpl::ScrollAnimationUpdateTarget returns false // since no keyframe_model exists. TODO(sahel):remove this once the issue // is fixed. - base::debug::DumpWithoutCrashing(); + NOTREACHED(); } return scroll_status; }
diff --git a/chrome/VERSION b/chrome/VERSION index 8f849efb..2e22ea0 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=71 MINOR=0 -BUILD=3556 +BUILD=3557 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index f7704b9..09acc0c3 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -623,6 +623,7 @@ "//components/safe_browsing/android:safe_browsing_java", "//components/signin/core/browser/android:java", "//components/signin/core/browser/android:signin_java_test_support", + "//components/signin/core/browser/android:signin_javatests", "//components/sync:sync_java_test_support", "//components/sync/android:sync_java", "//components/sync/android:sync_javatests",
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/StreamLifecycleManager.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/StreamLifecycleManager.java index e7b9070..b268868 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/StreamLifecycleManager.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/StreamLifecycleManager.java
@@ -15,7 +15,9 @@ import org.chromium.chrome.browser.ntp.NewTabPage; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.content_public.browser.NavigationController; import org.chromium.content_public.browser.NavigationEntry; @@ -83,12 +85,12 @@ } @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { show(); } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { hide(); }
diff --git a/chrome/android/java/res/layout/contextual_suggestions_toolbar.xml b/chrome/android/java/res/layout/contextual_suggestions_toolbar.xml index 587833a..3e0cb81 100644 --- a/chrome/android/java/res/layout/contextual_suggestions_toolbar.xml +++ b/chrome/android/java/res/layout/contextual_suggestions_toolbar.xml
@@ -48,7 +48,9 @@ android:layout_weight="1" android:singleLine="true" android:ellipsize="end" - android:textAppearance="@style/BlackTitle1" /> + android:textAppearance="@style/BlackTitle1" + android:focusable="true" + android:focusableInTouchMode="true" /> <org.chromium.chrome.browser.widget.ListMenuButton android:id="@+id/more" @@ -66,7 +68,7 @@ android:background="?attr/selectableItemBackground" android:src="@drawable/btn_close" android:scaleType="center" - android:contentDescription="@string/close" + android:contentDescription="@string/contextual_suggestions_close_button_description" app:chrometint="@color/dark_mode_tint" /> </LinearLayout>
diff --git a/chrome/android/java/res/layout/page_info.xml b/chrome/android/java/res/layout/page_info.xml index 6374953..1fce45e 100644 --- a/chrome/android/java/res/layout/page_info.xml +++ b/chrome/android/java/res/layout/page_info.xml
@@ -46,7 +46,31 @@ android:layout_height="wrap_content" android:lineSpacingExtra="3dp" android:paddingTop="8dp" - android:textAppearance="@style/BlackBodyDefault" /> + android:textAppearance="@style/BlackBodyDefault" + android:visibility="gone" /> + + <View + android:id="@+id/page_info_separator" + android:layout_marginTop="16dp" + style="@style/HorizontalDivider" + android:visibility="gone" /> + + <TextView + android:id="@+id/page_info_preview_message" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="14dp" + android:textAppearance="@style/BlackTitle1" + android:text="@string/page_info_preview_message" + android:visibility="gone" /> + + <TextView + android:id="@+id/page_info_preview_load_original" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="12dp" + android:textAppearance="@style/BlackTitle1" + android:visibility="gone" /> </LinearLayout> <org.chromium.ui.widget.ButtonCompat @@ -97,4 +121,4 @@ android:paddingEnd="@dimen/page_info_popup_button_padding_sides" android:paddingStart="@dimen/page_info_popup_button_padding_sides" android:text="@string/page_info_open_online_button" /> -</LinearLayout> \ No newline at end of file +</LinearLayout>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java index d9fb45e..ca654bd4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
@@ -128,6 +128,7 @@ import org.chromium.chrome.browser.tabmodel.EmptyTabModel; import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabModel; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; import org.chromium.chrome.browser.tabmodel.TabModelUtils; @@ -678,7 +679,7 @@ } @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { setStatusBarColor(tab, tab.getThemeColor()); } @@ -1488,9 +1489,6 @@ if (mContextualSearchManager != null) { mContextualSearchManager.onAccessibilityModeChanged(enabled); } - if (mContextualSuggestionsCoordinator != null) { - mContextualSuggestionsCoordinator.onAccessibilityModeChanged(enabled); - } } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingMediator.java index 869a329..774a8de4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingMediator.java
@@ -23,6 +23,7 @@ import org.chromium.chrome.browser.fullscreen.FullscreenOptions; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelObserver; @@ -123,7 +124,7 @@ private final TabObserver mTabObserver = new EmptyTabObserver() { @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { pause(); } @@ -189,6 +190,8 @@ void onKeyboardVisibilityChanged(boolean isShowing) { if (!mKeyboardAccessory.hasContents()) return; // Exit early to not affect the layout. if (isShowing) { + // Don't open the accessory inside the contextual search panel. + if (mActivity.getContextualSearchManager().isSearchPanelOpened()) return; mKeyboardAccessory.requestShowing(); mActivity.getFullscreenManager().setBottomControlsHeight(calculateAccessoryBarHeight()); mKeyboardAccessory.closeActiveTab();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java index 18114f6..f71a20c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java
@@ -37,10 +37,12 @@ import org.chromium.chrome.browser.fullscreen.FullscreenManager; import org.chromium.chrome.browser.ntp.NewTabPage; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabModel; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; @@ -384,12 +386,12 @@ mTabModelSelector = selector; mTabModelSelectorTabObserver = new TabModelSelectorTabObserver(mTabModelSelector) { @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { initLayoutTabFromHost(tab.getId()); } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { initLayoutTabFromHost(tab.getId()); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/StaticLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/StaticLayout.java index 4e93c54..ca0b42a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/StaticLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/StaticLayout.java
@@ -8,7 +8,6 @@ import android.graphics.RectF; import android.os.Handler; -import org.chromium.chrome.R; import org.chromium.chrome.browser.compositor.LayerTitleCache; import org.chromium.chrome.browser.compositor.animation.CompositorAnimator; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManager; @@ -78,7 +77,7 @@ mHandler = new Handler(); mUnstallRunnable = new UnstallRunnable(); mUnstalling = false; - mSceneLayer = new StaticTabSceneLayer(R.id.control_container); + mSceneLayer = new StaticTabSceneLayer(); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/StaticTabSceneLayer.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/StaticTabSceneLayer.java index 647c584..9f86463 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/StaticTabSceneLayer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/StaticTabSceneLayer.java
@@ -19,12 +19,6 @@ // downcast using reinterpret_cast<>. We keep a separate pointer to avoid it. private long mNativePtr; - private final int mResToolbarControlContainer; - - public StaticTabSceneLayer(int resToolbarControlContainer) { - mResToolbarControlContainer = resToolbarControlContainer; - } - /** * Update {@link StaticTabSceneLayer} with the given parameters. * @@ -48,9 +42,9 @@ float y = contentOffset + layoutTab.getRenderY() * dpToPx; nativeUpdateTabLayer(mNativePtr, tabContentManager, layoutTab.getId(), - mResToolbarControlContainer, layoutTab.canUseLiveTexture(), - layoutTab.getBackgroundColor(), x, y, layoutTab.getStaticToViewBlend(), - layoutTab.getSaturation(), layoutTab.getBrightness()); + layoutTab.canUseLiveTexture(), layoutTab.getBackgroundColor(), x, y, + layoutTab.getStaticToViewBlend(), layoutTab.getSaturation(), + layoutTab.getBrightness()); } @Override @@ -69,7 +63,7 @@ private native long nativeInit(); private native void nativeUpdateTabLayer(long nativeStaticTabSceneLayer, - TabContentManager tabContentManager, int id, int toolbarResourceId, - boolean canUseLiveLayer, int backgroundColor, float x, float y, float staticToViewBlend, - float saturation, float brightness); + TabContentManager tabContentManager, int id, boolean canUseLiveLayer, + int backgroundColor, float x, float y, float staticToViewBlend, float saturation, + float brightness); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsBottomSheetContent.java b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsBottomSheetContent.java index fb2445f2..1ec8bef 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsBottomSheetContent.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsBottomSheetContent.java
@@ -6,6 +6,7 @@ import android.view.View; +import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetContent; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.ContentPriority; @@ -68,4 +69,24 @@ public boolean useSlimPeek() { return mUseSlimPeek; } + + @Override + public int getSheetContentDescriptionStringId() { + return R.string.contextual_suggestions_button_description; + } + + @Override + public int getSheetHalfHeightAccessibilityStringId() { + return R.string.contextual_suggestions_sheet_opened_half; + } + + @Override + public int getSheetFullHeightAccessibilityStringId() { + return R.string.contextual_suggestions_sheet_opened_full; + } + + @Override + public int getSheetClosedAccessibilityStringId() { + return R.string.contextual_suggestions_sheet_closed; + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsCoordinator.java index 1038eac0..1e98e632 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsCoordinator.java
@@ -79,14 +79,6 @@ } /** - * Called when accessibility mode changes. - * @param enabled Whether accessibility mode is enabled. - */ - public void onAccessibilityModeChanged(boolean enabled) { - mMediator.onAccessibilityModeChanged(); - } - - /** * Show the contextual suggestions content in the {@link BottomSheet}. * Only the views needed for peeking the bottom sheet will be constructed. Another * call to {@link #displaySuggestions()} is needed to finish inflating views for the
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsEnabledStateUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsEnabledStateUtils.java index 8e29513b..f5018e3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsEnabledStateUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsEnabledStateUtils.java
@@ -11,7 +11,6 @@ import org.chromium.chrome.browser.preferences.PrefServiceBridge; import org.chromium.chrome.browser.search_engines.TemplateUrlService; import org.chromium.chrome.browser.sync.ProfileSyncService; -import org.chromium.chrome.browser.util.AccessibilityUtil; import org.chromium.components.signin.ChromeSigninController; /** Utility functions related to enabled state of Contextual Suggestions. */ @@ -21,18 +20,16 @@ /** @return Whether the user settings for contextual suggestions should be shown. */ public static boolean shouldShowSettings() { - return isDSEConditionMet() && !AccessibilityUtil.isAccessibilityEnabled() + return isDSEConditionMet() && ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_SUGGESTIONS_OPT_OUT); } /** @return Whether the settings state is currently enabled. */ static boolean getSettingsEnabled() { - boolean isAccessibilityEnabled = AccessibilityUtil.isAccessibilityEnabled(); - return isDSEConditionMet() && !isAccessibilityEnabled - && !ContextualSuggestionsBridge.isDisabledByEnterprisePolicy() + return isDSEConditionMet() && !ContextualSuggestionsBridge.isDisabledByEnterprisePolicy() && ChromeSigninController.get().isSignedIn() && (ProfileSyncService.get().isUrlKeyedDataCollectionEnabled(false) - || ProfileSyncService.get().isUrlKeyedDataCollectionEnabled(true)); + || ProfileSyncService.get().isUrlKeyedDataCollectionEnabled(true)); } /** @return Whether the state is currently enabled. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsMediator.java index a3e24e59..d364b3b1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsMediator.java
@@ -25,6 +25,7 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.toolbar.ToolbarManager; +import org.chromium.chrome.browser.util.AccessibilityUtil; import org.chromium.chrome.browser.util.MathUtils; import org.chromium.chrome.browser.widget.ListMenuButton; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; @@ -59,6 +60,7 @@ implements EnabledStateMonitor.Observer, FetchHelper.Delegate, ListMenuButton.Delegate { private static final float INVALID_PERCENTAGE = -1f; private static final int IPH_AUTO_DISMISS_TIMEOUT_MS = 6000; + private static final int IPH_AUTO_DISMISS_ACCESSIBILITY_TIMEOUT_MS = 10000; private static boolean sOverrideBrowserControlsHiddenForTesting; private final Profile mProfile; @@ -220,11 +222,6 @@ mEnabledStateMonitor.removeObserver(this); } - /** Called when accessibility mode changes. */ - void onAccessibilityModeChanged() { - mEnabledStateMonitor.onAccessibilityModeChanged(); - } - /** * @return Whether the browser controls are currently completely hidden. */ @@ -502,7 +499,9 @@ mModel.setToolbarTranslationPercent(1.f); } mModel.setMenuButtonDelegate(this); - mModel.setDefaultToolbarClickListener(view -> mCoordinator.expandBottomSheet()); + if (!mToolbarButtonEnabled) { + mModel.setDefaultToolbarClickListener(view -> mCoordinator.expandBottomSheet()); + } mModel.setTitle(!TextUtils.isEmpty(title) ? title : ContextUtils.getApplicationContext().getResources().getString( @@ -631,8 +630,8 @@ if (mModel.isSlimPeekEnabled() || mToolbarButtonEnabled) { mHelpBubble = new ImageTextBubble(mIphParentView.getContext(), mIphParentView, R.string.contextual_suggestions_in_product_help, - R.string.contextual_suggestions_in_product_help, true, rectProvider, - R.drawable.ic_logo_googleg_24dp); + R.string.contextual_suggestions_in_product_help_accessibility, true, + rectProvider, R.drawable.ic_logo_googleg_24dp); if (!mToolbarButtonEnabled) { mModel.setToolbarArrowTintResourceId(R.color.default_icon_color_blue); } @@ -643,7 +642,9 @@ } mHelpBubble.setDismissOnTouchInteraction(false); - mHelpBubble.setAutoDismissTimeout(IPH_AUTO_DISMISS_TIMEOUT_MS); + mHelpBubble.setAutoDismissTimeout(AccessibilityUtil.isAccessibilityEnabled() + ? IPH_AUTO_DISMISS_ACCESSIBILITY_TIMEOUT_MS + : IPH_AUTO_DISMISS_TIMEOUT_MS); mHelpBubble.addOnDismissListener(() -> { tracker.dismissed(FeatureConstants.CONTEXTUAL_SUGGESTIONS_FEATURE); mHelpBubble = null;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsModel.java b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsModel.java index 501d48f..a23c9555 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsModel.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/ContextualSuggestionsModel.java
@@ -57,10 +57,16 @@ // This is only the list of initially set properties and doesn't reflect changes after the // object has been created. but currently this method is only called initially. // Once this model is migrated to PropertyModel, the implementation will be correct. - return Arrays.asList(PropertyKey.CLOSE_BUTTON_ON_CLICK_LISTENER, - PropertyKey.MENU_BUTTON_VISIBILITY, PropertyKey.MENU_BUTTON_DELEGATE, - PropertyKey.TITLE, PropertyKey.DEFAULT_TOOLBAR_ON_CLICK_LISTENER, - PropertyKey.SLIM_PEEK_ENABLED); + if (getDefaultToolbarClickListener() != null) { + return Arrays.asList(PropertyKey.CLOSE_BUTTON_ON_CLICK_LISTENER, + PropertyKey.MENU_BUTTON_VISIBILITY, PropertyKey.MENU_BUTTON_DELEGATE, + PropertyKey.TITLE, PropertyKey.DEFAULT_TOOLBAR_ON_CLICK_LISTENER, + PropertyKey.SLIM_PEEK_ENABLED); + } else { + return Arrays.asList(PropertyKey.CLOSE_BUTTON_ON_CLICK_LISTENER, + PropertyKey.MENU_BUTTON_VISIBILITY, PropertyKey.MENU_BUTTON_DELEGATE, + PropertyKey.TITLE, PropertyKey.SLIM_PEEK_ENABLED); + } } /** @param clusters The current list of clusters. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/EnabledStateMonitor.java b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/EnabledStateMonitor.java index 14ab6916..10a50515 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/EnabledStateMonitor.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/EnabledStateMonitor.java
@@ -26,7 +26,4 @@ /** @return Whether the state is currently enabled. */ boolean getEnabledState(); - - /** Called when accessibility mode changes. */ - void onAccessibilityModeChanged(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/EnabledStateMonitorImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/EnabledStateMonitorImpl.java index 9d0a10e..e4b1d062 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/EnabledStateMonitorImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/EnabledStateMonitorImpl.java
@@ -65,11 +65,6 @@ } @Override - public void onAccessibilityModeChanged() { - updateEnabledState(); - } - - @Override public void syncStateChanged() { updateEnabledState(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/PageViewTimer.java b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/PageViewTimer.java index 3169add..e975c24b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/PageViewTimer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextual_suggestions/PageViewTimer.java
@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior.OverviewModeObserver; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelSelector; @@ -102,12 +103,12 @@ mTabObserver = new EmptyTabObserver() { @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { resumeMeasuring(); } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { pauseMeasuring(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java index 996d0e6..4ba608ed 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java
@@ -268,8 +268,19 @@ } private final Map<CustomTabsSessionToken, SessionParams> mSessionParams = new HashMap<>(); - private final Map<CustomTabsSessionToken, ActivityDelegate> mActivityDelegates - = new HashMap<>(); + + static class DynamicModuleSessionParams { + public final ActivityDelegate activityDelegate; + public final int moduleVersion; + + DynamicModuleSessionParams(ActivityDelegate activityDelegate, int moduleVersion) { + this.activityDelegate = activityDelegate; + this.moduleVersion = moduleVersion; + } + } + + private final Map<CustomTabsSessionToken, DynamicModuleSessionParams> + mDynamicModuleSessionParams = new HashMap<>(); private final SparseBooleanArray mUidHasCalledWarmup = new SparseBooleanArray(); private boolean mWarmupHasBeenCalled; @@ -786,7 +797,7 @@ if (params.originVerifier != null) params.originVerifier.cleanUp(); if (params.disconnectCallback != null) params.disconnectCallback.run(session); mUidHasCalledWarmup.delete(params.uid); - mActivityDelegates.remove(session); + mDynamicModuleSessionParams.remove(session); } /** @@ -819,12 +830,14 @@ } void setActivityDelegateForSession(CustomTabsSessionToken sessionToken, - ActivityDelegate activityDelegate) { - mActivityDelegates.put(sessionToken, activityDelegate); + ActivityDelegate activityDelegate, int moduleVersion) { + mDynamicModuleSessionParams.put(sessionToken, + new DynamicModuleSessionParams(activityDelegate, moduleVersion)); } @Nullable - ActivityDelegate getActivityDelegateForSession(CustomTabsSessionToken sessionToken) { - return mActivityDelegates.get(sessionToken); + DynamicModuleSessionParams getDynamicModuleParamsForSession( + CustomTabsSessionToken sessionToken) { + return mDynamicModuleSessionParams.get(sessionToken); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java index d5cc868..aa0329a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
@@ -386,7 +386,8 @@ if (mModuleOnStartPending) startModule(); if (mModuleOnResumePending) resumeModule(); - mConnection.setActivityDelegateForSession(mSession, mModuleActivityDelegate); + mConnection.setActivityDelegateForSession(mSession, mModuleActivityDelegate, + mModuleEntryPoint.getModuleVersion()); } private void startModule() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabNavigationEventObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabNavigationEventObserver.java index 2a7aa61..67a9f65 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabNavigationEventObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabNavigationEventObserver.java
@@ -9,6 +9,8 @@ import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.components.security_state.ConnectionSecurityLevel; /** @@ -44,13 +46,13 @@ } @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { CustomTabsConnection.getInstance().notifyNavigationEvent( mSessionToken, CustomTabsCallback.TAB_SHOWN); } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { CustomTabsConnection.getInstance().notifyNavigationEvent( mSessionToken, CustomTabsCallback.TAB_HIDDEN); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java index 1a0f42f..af87d265b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java
@@ -18,6 +18,7 @@ import org.chromium.chrome.browser.share.ShareHelper; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.browser.LoadUrlParams; @@ -119,7 +120,7 @@ } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int reason) { mNavigationInfoCaptureTrigger.onHide(tab); }
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 4cd54863..25d38c8 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
@@ -1103,9 +1103,10 @@ */ public boolean notifyNavigationEvent(CustomTabsSessionToken session, int navigationEvent) { // Notify dynamic module - ActivityDelegate activityDelegate = mClientManager.getActivityDelegateForSession(session); - if (activityDelegate != null) { - activityDelegate.onNavigationEvent(navigationEvent, + ClientManager.DynamicModuleSessionParams params = + mClientManager.getDynamicModuleParamsForSession(session); + if (params != null && params.moduleVersion >= 4) { + params.activityDelegate.onNavigationEvent(navigationEvent, getExtrasBundleForNavigationEventForSession(session)); } @@ -1496,7 +1497,7 @@ } public void setActivityDelegateForSession(CustomTabsSessionToken sessionToken, - ActivityDelegate activityDelegate) { - mClientManager.setActivityDelegateForSession(sessionToken, activityDelegate); + ActivityDelegate activityDelegate, int moduleVersion) { + mClientManager.setActivityDelegateForSession(sessionToken, activityDelegate, moduleVersion); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutController.java b/chrome/android/java/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutController.java index 30d7919..c338c64 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutController.java
@@ -17,6 +17,7 @@ import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContentsObserver; @@ -48,7 +49,7 @@ /** Listens to various Tab events. */ private final TabObserver mTabObserver = new EmptyTabObserver() { @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { assert tab == mTab; // Force a layout update if we are now being shown.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java index dd012a6..7728f3c4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java
@@ -22,6 +22,8 @@ import org.chromium.chrome.browser.document.ChromeLauncherActivity; import org.chromium.chrome.browser.infobar.ReaderModeInfoBar; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; import org.chromium.chrome.browser.util.IntentUtils; @@ -146,7 +148,7 @@ } @Override - public void onShown(Tab shownTab) { + public void onShown(Tab shownTab, @TabSelectionType int type) { if (mTabModelSelector == null) return; int shownTabId = shownTab.getId(); @@ -186,7 +188,7 @@ } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int reason) { ReaderModeTabInfo info = mTabStatusMap.get(tab.getId()); if (info != null && info.isViewingReaderModePage()) { long timeMs = info.onExitReaderMode();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SurveyInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/SurveyInfoBar.java index b8edfba..81c6226 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SurveyInfoBar.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/SurveyInfoBar.java
@@ -16,6 +16,7 @@ import org.chromium.chrome.browser.survey.SurveyController; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.util.AccessibilityUtil; import org.chromium.content_public.browser.WebContents; import org.chromium.ui.text.NoUnderlineClickableSpan; @@ -87,7 +88,7 @@ Tab tab = nativeGetTab(getNativeInfoBarPtr()); tab.addObserver(new EmptyTabObserver() { @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { mDelegate.onSurveyInfoBarTabHidden(); tab.removeObserver(this);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java index c684de6..aaa71f4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java
@@ -23,6 +23,7 @@ import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.components.url_formatter.UrlFormatter; import org.chromium.content_public.browser.MediaSession; import org.chromium.content_public.browser.MediaSessionObserver; @@ -355,7 +356,7 @@ } @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { assert tab == mTab; MediaNotificationManager.activateAndroidMediaSession( tab.getId(), R.id.media_playback_notification);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java index d7d07b5f..f54f883 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
@@ -48,7 +48,9 @@ import org.chromium.chrome.browser.suggestions.TileGroupDelegateImpl; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.util.ColorUtils; import org.chromium.chrome.browser.util.UrlUtilities; @@ -293,7 +295,7 @@ mTabObserver = new EmptyTabObserver() { @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { // Showing the NTP is only meaningful when the page has been loaded already. if (mIsLoaded) recordNTPShown(); @@ -301,7 +303,7 @@ } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { if (mIsLoaded) recordNTPHidden(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserver.java index faf77fe4..c699261 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserver.java
@@ -17,6 +17,8 @@ import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarController; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabModelObserver; @@ -147,14 +149,14 @@ } @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { Log.d(TAG, "onShow"); maybeShowReloadSnackbar(tab, false); mCurrentTab = tab; } @Override - public void onHidden(Tab hiddenTab) { + public void onHidden(Tab hiddenTab, @TabHidingType int type) { Log.d(TAG, "onHidden"); mCurrentTab = null; mSnackbarManager.dismissSnackbars(mSnackbarController);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorController.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorController.java index dfbddd2..edc6a23 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorController.java
@@ -27,6 +27,7 @@ import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.common.ContentUrlConstants; @@ -192,7 +193,7 @@ } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { mObservedActivity = null; tab.removeObserver(this); doUpdate();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoController.java b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoController.java index c1b85217..7b357e2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoController.java
@@ -42,6 +42,7 @@ import org.chromium.chrome.browser.preferences.PreferencesLauncher; import org.chromium.chrome.browser.preferences.website.ContentSetting; import org.chromium.chrome.browser.preferences.website.SingleWebsitePreferences; +import org.chromium.chrome.browser.previews.PreviewsAndroidBridge; import org.chromium.chrome.browser.ssl.SecurityStateModel; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.util.UrlUtilities; @@ -52,6 +53,9 @@ import org.chromium.content_public.browser.WebContentsObserver; import org.chromium.ui.base.DeviceFormFactor; import org.chromium.ui.base.WindowAndroid; +import org.chromium.ui.text.NoUnderlineClickableSpan; +import org.chromium.ui.text.SpanApplier; +import org.chromium.ui.text.SpanApplier.SpanInfo; import org.chromium.ui.widget.Toast; import java.lang.annotation.Retention; @@ -83,6 +87,15 @@ int UNTRUSTED_OFFLINE_PAGE = 3; } + @IntDef({PreviewPageState.NOT_PREVIEW, PreviewPageState.SECURE_PAGE_PREVIEW, + PreviewPageState.INSECURE_PAGE_PREVIEW}) + @Retention(RetentionPolicy.SOURCE) + public @interface PreviewPageState { + int NOT_PREVIEW = 1; + int SECURE_PAGE_PREVIEW = 2; + int INSECURE_PAGE_PREVIEW = 3; + } + private final Context mContext; private final WindowAndroid mWindowAndroid; private final Tab mTab; @@ -115,6 +128,9 @@ // Creation date of an offline copy, if web contents contains an offline page. private String mOfflinePageCreationDate; + // The state of the preview of the page (not preview, preview on a [in]secure page). + private @PreviewPageState int mPreviewPageState; + // The state of offline page in the web contents (not offline page, trusted/untrusted offline // page). private @OfflinePageState int mOfflinePageState; @@ -134,17 +150,23 @@ * C++ object and saves a pointer to it. * @param activity Activity which is used for showing a popup. * @param tab Tab for which the pop up is shown. + * @param securityLevel The security level of the page being shown. * @param offlinePageUrl URL that the offline page claims to be generated from. * @param offlinePageCreationDate Date when the offline page was created. * @param offlinePageState State of the tab showing offline page. + * @param previewOriginalHost The domain of the original page of the displayed preview. + * @param previewPageState State of the tab showing the preview. * @param publisher The name of the content publisher, if any. */ - protected PageInfoController(Activity activity, Tab tab, String offlinePageUrl, - String offlinePageCreationDate, @OfflinePageState int offlinePageState, - String publisher) { + protected PageInfoController(Activity activity, Tab tab, int securityLevel, + String offlinePageUrl, String offlinePageCreationDate, + @OfflinePageState int offlinePageState, String previewOriginalHost, + @PreviewPageState int previewPageState, String publisher) { mContext = activity; mTab = tab; + mSecurityLevel = securityLevel; mOfflinePageState = offlinePageState; + mPreviewPageState = previewPageState; PageInfoViewParams viewParams = new PageInfoViewParams(); if (mOfflinePageState != OfflinePageState.NOT_OFFLINE_PAGE) { @@ -179,7 +201,6 @@ mParsedUrl = null; mIsInternalPage = false; } - mSecurityLevel = SecurityStateModel.getSecurityLevelForWebContents(mTab.getWebContents()); String displayUrl = UrlFormatter.formatUrlForCopy(mFullUrl); if (isShowingOfflinePage()) { @@ -202,11 +223,7 @@ viewParams.urlOriginLength = OmniboxUrlEmphasizer.getOriginEndIndex( displayUrlBuilder.toString(), mTab.getProfile()); - if (mParsedUrl == null || mParsedUrl.getScheme() == null || isShowingOfflinePage() - || !(mParsedUrl.getScheme().equals(UrlConstants.HTTP_SCHEME) - || mParsedUrl.getScheme().equals(UrlConstants.HTTPS_SCHEME))) { - viewParams.siteSettingsButtonShown = false; - } else { + if (shouldShowSiteSettingsButton(mParsedUrl)) { viewParams.siteSettingsButtonClickCallback = () -> { // Delay while the dialog closes. runAfterDismiss(() -> { @@ -223,8 +240,12 @@ } }); }; + } else { + viewParams.siteSettingsButtonShown = false; } + initPreviewUiParams(viewParams, previewOriginalHost); + if (isShowingOfflinePage()) { boolean isConnected = OfflinePageUtils.isConnected(); RecordHistogram.recordBooleanHistogram( @@ -249,7 +270,7 @@ } InstantAppsHandler instantAppsHandler = InstantAppsHandler.getInstance(); - if (!mIsInternalPage && !isShowingOfflinePage() + if (!mIsInternalPage && !isShowingOfflinePage() && !isShowingPreview() && instantAppsHandler.isInstantAppAvailable(mFullUrl, false /* checkHoldback */, false /* includeUserPrefersBrowser */)) { final Intent instantAppIntent = instantAppsHandler.getInstantAppIntentForUrl(mFullUrl); @@ -303,12 +324,42 @@ } /** + * Initializes the state in viewParams with respect to showing the previews UI. + * + * @param viewParams The PageInfoViewParams to set state on. + * @param previewOriginalHost The hostname of the displayed preview page. + */ + private void initPreviewUiParams(PageInfoViewParams viewParams, String previewOriginalHost) { + viewParams.separatorShown = mPreviewPageState == PreviewPageState.INSECURE_PAGE_PREVIEW; + viewParams.previewUIShown = isShowingPreview(); + if (isShowingPreview()) { + viewParams.urlTitleShown = false; + viewParams.connectionMessageShown = false; + + viewParams.previewShowOriginalClickCallback = () -> { + runAfterDismiss(() -> { + PreviewsAndroidBridge.getInstance().loadOriginal(mTab.getWebContents()); + }); + }; + final String loadOriginalText = mContext.getString( + R.string.page_info_preview_load_original, previewOriginalHost); + final SpannableString loadOriginalSpan = SpanApplier.applySpans(loadOriginalText, + new SpanInfo("<link>", "</link>", + // The callback given to NoUnderlineClickableSpan is overridden in + // PageInfoView so use previewShowOriginalClickCallback (above) instead + // because the entire TextView will be clickable. + new NoUnderlineClickableSpan((view) -> {}))); + viewParams.previewLoadOriginalMessage = loadOriginalSpan; + } + } + + /** * Whether to show a 'Details' link to the connection info popup. The link is only shown for * HTTPS connections. */ private boolean isConnectionDetailsLinkVisible() { - return mContentPublisher == null && !isShowingOfflinePage() && mParsedUrl != null - && mParsedUrl.getScheme() != null + return mContentPublisher == null && !isShowingOfflinePage() && !isShowingPreview() + && mParsedUrl != null && mParsedUrl.getScheme() != null && mParsedUrl.getScheme().equals(UrlConstants.HTTPS_SCHEME); } @@ -346,6 +397,10 @@ if (mContentPublisher != null) { messageBuilder.append( mContext.getString(R.string.page_info_domain_hidden, mContentPublisher)); + } else if (isShowingPreview()) { + if (mPreviewPageState == PreviewPageState.INSECURE_PAGE_PREVIEW) { + connectionInfoParams.summary = summary; + } } else if (mOfflinePageState == OfflinePageState.TRUSTED_OFFLINE_PAGE) { messageBuilder.append( String.format(mContext.getString(R.string.page_info_connection_offline), @@ -379,7 +434,11 @@ messageBuilder.append(detailsText); } - connectionInfoParams.message = messageBuilder; + // When a preview is being shown for a secure page, the security message is not shown. Thus, + // messageBuilder maybe empty. + if (messageBuilder.length() > 0) { + connectionInfoParams.message = messageBuilder; + } if (isConnectionDetailsLinkVisible()) { connectionInfoParams.clickCallback = () -> { runAfterDismiss(() -> { @@ -441,10 +500,35 @@ } /** + * Whether website dialog is displayed for a preview. + */ + private boolean isShowingPreview() { + return mPreviewPageState != PreviewPageState.NOT_PREVIEW; + } + + /** * Whether website dialog is displayed for an offline page. */ private boolean isShowingOfflinePage() { - return mOfflinePageState != OfflinePageState.NOT_OFFLINE_PAGE; + return mOfflinePageState != OfflinePageState.NOT_OFFLINE_PAGE && !isShowingPreview(); + } + + /** + * Whether the site settings button should be displayed for the given URI. + * + * @param uri The URI used to determine if the site settings button should be displayed. + */ + private boolean shouldShowSiteSettingsButton(URI uri) { + if (uri == null || uri.getScheme() == null) { + return false; + } + + if (isShowingOfflinePage() || isShowingPreview()) { + return false; + } + + return uri.getScheme().equals(UrlConstants.HTTP_SCHEME) + || uri.getScheme().equals(UrlConstants.HTTPS_SCHEME); } private boolean isSheet() { @@ -479,6 +563,20 @@ assert false : "Invalid source passed"; } + final int securityLevel = + SecurityStateModel.getSecurityLevelForWebContents(tab.getWebContents()); + + final PreviewsAndroidBridge previewsBridge = PreviewsAndroidBridge.getInstance(); + @PreviewPageState + int previewPageState = PreviewPageState.NOT_PREVIEW; + String previewOriginalHost = null; + if (previewsBridge.shouldShowPreviewUI(tab.getWebContents())) { + previewPageState = securityLevel == ConnectionSecurityLevel.SECURE + ? PreviewPageState.SECURE_PAGE_PREVIEW + : PreviewPageState.INSECURE_PAGE_PREVIEW; + previewOriginalHost = previewsBridge.getOriginalHost(tab.getWebContents()); + } + String offlinePageUrl = null; String offlinePageCreationDate = null; @OfflinePageState @@ -503,8 +601,9 @@ } } - new PageInfoController(activity, tab, offlinePageUrl, offlinePageCreationDate, - offlinePageState, contentPublisher); + new PageInfoController(activity, tab, securityLevel, offlinePageUrl, + offlinePageCreationDate, offlinePageState, previewOriginalHost, previewPageState, + contentPublisher); } private static native long nativeInit(PageInfoController controller, WebContents webContents);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoView.java b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoView.java index 54ffb4b2..dad888eb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoView.java
@@ -153,17 +153,23 @@ /** Parameters to configure the view of the page info popup. */ public static class PageInfoViewParams { + public boolean urlTitleShown = true; + public boolean connectionMessageShown = true; public boolean instantAppButtonShown = true; public boolean siteSettingsButtonShown = true; public boolean openOnlineButtonShown = true; + public boolean previewUIShown = true; + public boolean separatorShown = true; public Runnable urlTitleClickCallback; public Runnable urlTitleLongClickCallback; public Runnable instantAppButtonClickCallback; public Runnable siteSettingsButtonClickCallback; public Runnable openOnlineButtonClickCallback; + public Runnable previewShowOriginalClickCallback; public CharSequence url; + public CharSequence previewLoadOriginalMessage; public int urlOriginLength; } @@ -181,6 +187,7 @@ public static class ConnectionInfoParams { public CharSequence message; public CharSequence summary; + public CharSequence previewLoadOriginalMessage; public Runnable clickCallback; } @@ -191,7 +198,10 @@ private final ElidedUrlTextView mUrlTitle; private final TextView mConnectionSummary; private final TextView mConnectionMessage; + private final TextView mPreviewMessage; + private final TextView mPreviewLoadOriginal; private final LinearLayout mPermissionsList; + private final View mSeparator; private final Button mInstantAppButton; private final Button mSiteSettingsButton; private final Button mOpenOnlineButton; @@ -205,7 +215,10 @@ mUrlTitle = (ElidedUrlTextView) findViewById(R.id.page_info_url); mConnectionSummary = (TextView) findViewById(R.id.page_info_connection_summary); mConnectionMessage = (TextView) findViewById(R.id.page_info_connection_message); + mPreviewMessage = (TextView) findViewById(R.id.page_info_preview_message); + mPreviewLoadOriginal = (TextView) findViewById(R.id.page_info_preview_load_original); mPermissionsList = (LinearLayout) findViewById(R.id.page_info_permissions_list); + mSeparator = (View) findViewById(R.id.page_info_separator); mInstantAppButton = (Button) findViewById(R.id.page_info_instant_app_button); mSiteSettingsButton = (Button) findViewById(R.id.page_info_site_settings_button); mOpenOnlineButton = (Button) findViewById(R.id.page_info_open_online_button); @@ -216,10 +229,11 @@ mUrlTitle.setOnLongClickListener(this); } - initializePageInfoViewChild(mUrlTitle, true, 0f, params.urlTitleClickCallback); + initializePageInfoViewChild( + mUrlTitle, params.urlTitleShown, 0f, params.urlTitleClickCallback); // Hide the summary until its text is set. initializePageInfoViewChild(mConnectionSummary, false, 0f, null); - initializePageInfoViewChild(mConnectionMessage, true, 0f, null); + initializePageInfoViewChild(mConnectionMessage, params.connectionMessageShown, 0f, null); // Hide the permissions list for sites with no permissions. initializePageInfoViewChild(mPermissionsList, false, 1f, null); initializePageInfoViewChild(mInstantAppButton, params.instantAppButtonShown, 0f, @@ -229,6 +243,12 @@ // The open online button should not fade in. initializePageInfoViewChild(mOpenOnlineButton, params.openOnlineButtonShown, 1f, params.openOnlineButtonClickCallback); + // Previews UI initialization. + initializePageInfoViewChild(mPreviewMessage, params.previewUIShown, 0f, null); + initializePageInfoViewChild(mPreviewLoadOriginal, params.previewUIShown, 0f, + params.previewShowOriginalClickCallback); + initializePageInfoViewChild(mSeparator, params.separatorShown, 0f, null); + mPreviewLoadOriginal.setText(params.previewLoadOriginalMessage); } public void setPermissions(List<PermissionParams> permissionParamsList) { @@ -241,14 +261,17 @@ } public void setConnectionInfo(ConnectionInfoParams params) { - mConnectionMessage.setText(params.message); if (params.summary != null) { mConnectionSummary.setVisibility(View.VISIBLE); mConnectionSummary.setText(params.summary); } - if (params.clickCallback != null) { - mConnectionMessage.setTag(R.id.page_info_click_callback, params.clickCallback); - mConnectionMessage.setOnClickListener(this); + if (params.message != null) { + mConnectionMessage.setVisibility(View.VISIBLE); + mConnectionMessage.setText(params.message); + if (params.clickCallback != null) { + mConnectionMessage.setTag(R.id.page_info_click_callback, params.clickCallback); + mConnectionMessage.setOnClickListener(this); + } } } @@ -339,10 +362,11 @@ private List<View> collectAnimatableViews() { List<View> animatableViews = new ArrayList<View>(); animatableViews.add(mUrlTitle); - if (mConnectionSummary.getVisibility() == View.VISIBLE) { - animatableViews.add(mConnectionSummary); - } + animatableViews.add(mConnectionSummary); animatableViews.add(mConnectionMessage); + animatableViews.add(mPreviewMessage); + animatableViews.add(mPreviewLoadOriginal); + animatableViews.add(mSeparator); animatableViews.add(mInstantAppButton); for (int i = 0; i < mPermissionsList.getChildCount(); i++) { animatableViews.add(mPermissionsList.getChildAt(i)); @@ -380,8 +404,10 @@ List<View> animatableViews = collectAnimatableViews(); for (int i = 0; i < animatableViews.size(); i++) { View view = animatableViews.get(i); - Animator anim = createInnerFadeAnimation(view, i, isEnter); - builder.with(anim); + if (view.getVisibility() == View.VISIBLE) { + Animator anim = createInnerFadeAnimation(view, i, isEnter); + builder.with(anim); + } } return animation;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java index 87cc483..fd0c0ac4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java
@@ -12,7 +12,10 @@ import android.os.SystemClock; import android.preference.Preference; import android.preference.PreferenceFragment; +import android.support.annotation.DrawableRes; +import android.support.annotation.IntDef; import android.support.annotation.Nullable; +import android.support.v4.util.ArraySet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -35,9 +38,9 @@ import org.chromium.chrome.browser.preferences.SpinnerPreference; import org.chromium.chrome.browser.preferences.privacy.BrowsingDataCounterBridge.BrowsingDataCounterCallback; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; -import java.util.Arrays; -import java.util.EnumSet; import java.util.List; import java.util.concurrent.TimeUnit; @@ -56,19 +59,19 @@ Preference.OnPreferenceClickListener { private static final int MIN_DP_FOR_ICON = 360; private final ClearBrowsingDataPreferences mParent; - private final DialogOption mOption; + private final @DialogOption int mOption; private final ClearBrowsingDataCheckBoxPreference mCheckbox; private BrowsingDataCounterBridge mCounter; private boolean mShouldAnnounceCounterResult; - public Item(Context context, ClearBrowsingDataPreferences parent, DialogOption option, + public Item(Context context, ClearBrowsingDataPreferences parent, @DialogOption int option, ClearBrowsingDataCheckBoxPreference checkbox, boolean selected, boolean enabled) { super(); mParent = parent; mOption = option; mCheckbox = checkbox; - mCounter = new BrowsingDataCounterBridge( - this, mOption.getDataType(), mParent.getPreferenceType()); + mCounter = new BrowsingDataCounterBridge(this, + ClearBrowsingDataPreferences.getDataType(mOption), mParent.getPreferenceType()); mCheckbox.setOnPreferenceClickListener(this); mCheckbox.setEnabled(enabled); @@ -76,7 +79,8 @@ int dp = mParent.getResources().getConfiguration().smallestScreenWidthDp; if (dp >= MIN_DP_FOR_ICON) { - mCheckbox.setIcon(PreferenceUtils.getTintedIcon(context, option.getIcon())); + mCheckbox.setIcon(PreferenceUtils.getTintedIcon( + context, ClearBrowsingDataPreferences.getIcon(option))); } } @@ -84,7 +88,7 @@ mCounter.destroy(); } - public DialogOption getOption() { + public @DialogOption int getOption() { return mOption; } @@ -99,7 +103,8 @@ mParent.updateButtonState(); mShouldAnnounceCounterResult = true; PrefServiceBridge.getInstance().setBrowsingDataDeletionPreference( - mOption.getDataType(), mParent.getPreferenceType(), mCheckbox.isChecked()); + ClearBrowsingDataPreferences.getDataType(mOption), mParent.getPreferenceType(), + mCheckbox.isChecked()); return true; } @@ -121,88 +126,6 @@ } } - @VisibleForTesting - public static final String PREF_HISTORY = "clear_history_checkbox"; - @VisibleForTesting - public static final String PREF_COOKIES = "clear_cookies_checkbox"; - private static final String PREF_CACHE = "clear_cache_checkbox"; - private static final String PREF_PASSWORDS = "clear_passwords_checkbox"; - private static final String PREF_FORM_DATA = "clear_form_data_checkbox"; - private static final String PREF_SITE_SETTINGS = "clear_site_settings_checkbox"; - private static final String PREF_MEDIA_LICENSES = "clear_media_licenses_checkbox"; - - @VisibleForTesting - public static final String PREF_GOOGLE_SUMMARY = "google_summary"; - @VisibleForTesting - public static final String PREF_GENERAL_SUMMARY = "general_summary"; - private static final String PREF_TIME_RANGE = "time_period_spinner"; - - /** The "Clear" button preference. */ - @VisibleForTesting - public static final String PREF_CLEAR_BUTTON = "clear_button"; - - /** The tag used for logging. */ - public static final String TAG = "ClearBrowsingDataPreferences"; - - /** The histogram for the dialog about other forms of browsing history. */ - private static final String DIALOG_HISTOGRAM = - "History.ClearBrowsingData.ShownHistoryNoticeAfterClearing"; - - /** - * Used for the onActivityResult pattern. The value is arbitrary, just to distinguish from other - * activities that we might be using onActivityResult with as well. - */ - private static final int IMPORTANT_SITES_DIALOG_CODE = 1; - - private static final int IMPORTANT_SITES_PERCENTAGE_BUCKET_COUNT = 20; - - /** - * The various data types that can be cleared via this screen. - */ - public enum DialogOption { - CLEAR_HISTORY(BrowsingDataType.HISTORY, PREF_HISTORY, R.drawable.ic_watch_later_24dp), - CLEAR_COOKIES_AND_SITE_DATA( - BrowsingDataType.COOKIES, PREF_COOKIES, R.drawable.permission_cookie), - CLEAR_CACHE(BrowsingDataType.CACHE, PREF_CACHE, R.drawable.ic_collections_grey), - CLEAR_PASSWORDS(BrowsingDataType.PASSWORDS, PREF_PASSWORDS, R.drawable.ic_vpn_key_grey), - CLEAR_FORM_DATA(BrowsingDataType.FORM_DATA, PREF_FORM_DATA, R.drawable.ic_edit_24dp), - CLEAR_SITE_SETTINGS(BrowsingDataType.SITE_SETTINGS, PREF_SITE_SETTINGS, - R.drawable.ic_tv_options_input_settings_rotated_grey), - CLEAR_MEDIA_LICENSES(BrowsingDataType.MEDIA_LICENSES, PREF_MEDIA_LICENSES, - R.drawable.permission_protected_media); - - private final int mDataType; - private final String mPreferenceKey; - private final int mIcon; - - DialogOption(int dataType, String preferenceKey, int icon) { - mDataType = dataType; - mPreferenceKey = preferenceKey; - mIcon = icon; - } - - /** - * @return The {@link BrowsingDataType} this option represents. - */ - public int getDataType() { - return mDataType; - } - - /** - * @return The key of the corresponding preference. - */ - public String getPreferenceKey() { - return mPreferenceKey; - } - - /** - * @return The resource id for the icon that is used to display this option. - */ - public int getIcon() { - return mIcon; - } - } - /** * An option to be shown in the time period spiner. */ @@ -234,6 +157,92 @@ } } + @VisibleForTesting + public static final String PREF_GOOGLE_SUMMARY = "google_summary"; + @VisibleForTesting + public static final String PREF_GENERAL_SUMMARY = "general_summary"; + private static final String PREF_TIME_RANGE = "time_period_spinner"; + + /** The "Clear" button preference. */ + @VisibleForTesting + public static final String PREF_CLEAR_BUTTON = "clear_button"; + + /** The tag used for logging. */ + public static final String TAG = "ClearBrowsingDataPreferences"; + + /** The histogram for the dialog about other forms of browsing history. */ + private static final String DIALOG_HISTOGRAM = + "History.ClearBrowsingData.ShownHistoryNoticeAfterClearing"; + + /** + * Used for the onActivityResult pattern. The value is arbitrary, just to distinguish from other + * activities that we might be using onActivityResult with as well. + */ + private static final int IMPORTANT_SITES_DIALOG_CODE = 1; + + private static final int IMPORTANT_SITES_PERCENTAGE_BUCKET_COUNT = 20; + + /** + * The various data types that can be cleared via this screen. + */ + @IntDef({DialogOption.CLEAR_HISTORY, DialogOption.CLEAR_COOKIES_AND_SITE_DATA, + DialogOption.CLEAR_CACHE, DialogOption.CLEAR_PASSWORDS, DialogOption.CLEAR_FORM_DATA, + DialogOption.CLEAR_SITE_SETTINGS, DialogOption.CLEAR_MEDIA_LICENSES}) + @Retention(RetentionPolicy.SOURCE) + public @interface DialogOption { + // Used for indexing. Should start from 0 and can't have gaps. + // Lowest value is additionally used for starting "for" loop below. + int CLEAR_HISTORY = 0; + int CLEAR_COOKIES_AND_SITE_DATA = 1; + int CLEAR_CACHE = 2; + int CLEAR_PASSWORDS = 3; + int CLEAR_FORM_DATA = 4; + int CLEAR_SITE_SETTINGS = 5; + int CLEAR_MEDIA_LICENSES = 6; + int NUM_ENTRIES = 7; + } + + /** + * Mapping from {@link DialogOption} to {@link BrowsingDataType}. + */ + private final static int[] DATA_TYPES = { + BrowsingDataType.HISTORY, // DialogOption.CLEAR_HISTORY + BrowsingDataType.COOKIES, // DialogOption.CLEAR_COOKIES_AND_SITE_DATA + BrowsingDataType.CACHE, // DialogOption.CLEAR_CACHE + BrowsingDataType.PASSWORDS, // DialogOption.CLEAR_PASSWORDS + BrowsingDataType.FORM_DATA, // DialogOption.CLEAR_FORM_DATA + BrowsingDataType.SITE_SETTINGS, // DialogOption.CLEAR_SITE_SETTINGS + BrowsingDataType.MEDIA_LICENSES, // DialogOption.CLEAR_MEDIA_LICENSES + }; + + /** + * Mapping from {@link DialogOption} to the key name of the corresponding preference. + */ + private final static String[] PREFERENCE_KEYS = { + "clear_history_checkbox", // DialogOption.CLEAR_HISTORY + "clear_cookies_checkbox", // DialogOption_CLEAR_COOKIES_AND_SITE_DATA + "clear_cache_checkbox", // DialogOption.CLEAR_CACHE + "clear_passwords_checkbox", // DialogOption.CLEAR_PASSWORDS + "clear_form_data_checkbox", // DialogOption.CLEAR_FORM_DATA + "clear_site_settings_checkbox", // DialogOption.CLEAR_SITE_SETTINGS + "clear_media_licenses_checkbox", // DialogOption.CLEAR_MEDIA_LICENSES + }; + + /** + * The resource id for the icon that is used to display option. + * Indexed by {@link DialogOption}. + */ + private final static int[] ICONS = { + R.drawable.ic_watch_later_24dp, // DialogOption.CLEAR_HISTORY + R.drawable.permission_cookie, // DialogOption.CLEAR_COOKIES_AND_SITE_DATA + R.drawable.ic_collections_grey, // DialogOption.CLEAR_CACHE + R.drawable.ic_vpn_key_grey, // DialogOption.CLEAR_PASSWORDS + R.drawable.ic_edit_24dp, // DialogOption.CLEAR_FORM_DATA + R.drawable + .ic_tv_options_input_settings_rotated_grey, // DialogOption.CLEAR_SITE_SETTINGS + R.drawable.permission_protected_media, // DialogOption.CLEAR_MEDIA_LICENSES + }; + public static final String CLEAR_BROWSING_DATA_FETCHER = "clearBrowsingDataFetcher"; private OtherFormsOfHistoryDialogFragment mDialogAboutOtherFormsOfBrowsingHistory; @@ -249,6 +258,60 @@ // Time in ms, when the dialog was created. private long mDialogOpened; + static @BrowsingDataType int getDataType(@DialogOption int type) { + assert DATA_TYPES.length == DialogOption.NUM_ENTRIES; + + return DATA_TYPES[type]; + } + + static String getPreferenceKey(@DialogOption int type) { + assert PREFERENCE_KEYS.length == DialogOption.NUM_ENTRIES; + + return PREFERENCE_KEYS[type]; + } + + static @DrawableRes int getIcon(@DialogOption int type) { + assert ICONS.length == DialogOption.NUM_ENTRIES; + + return ICONS[type]; + } + + /** + * @return All available {@link DialogOption} entries. + */ + protected final static ArraySet<Integer> getAllOptions() { + ArraySet<Integer> all = new ArraySet<>(); + for (@DialogOption int i = DialogOption.CLEAR_HISTORY; i < DialogOption.NUM_ENTRIES; i++) { + all.add(i); + } + return all; + } + + /** + * Determine the array of data types to be deleted. + * @param options The set of selected {@link DialogOption} entries. + * @return int[] List of {@link BrowsingDataType} that should be deleted. + */ + protected int[] getDataTypesFromOptions(ArraySet<Integer> options) { + int[] dataTypes = new int[options.size()]; + int i = 0; + for (@DialogOption Integer option : options) { + dataTypes[i++] = getDataType(option); + } + return dataTypes; + } + + /** + * @return The currently selected {@link DialogOption} entries. + */ + protected final ArraySet<Integer> getSelectedOptions() { + ArraySet<Integer> selected = new ArraySet<>(); + for (Item item : mItems) { + if (item.isSelected()) selected.add(item.getOption()); + } + return selected; + } + /** * @param fetcher A ClearBrowsingDataFetcher. */ @@ -262,32 +325,6 @@ } /** - * @return The currently selected DialogOptions. - */ - protected final EnumSet<DialogOption> getSelectedOptions() { - EnumSet<DialogOption> selected = EnumSet.noneOf(DialogOption.class); - for (Item item : mItems) { - if (item.isSelected()) selected.add(item.getOption()); - } - return selected; - } - - /** - * Determine the array of data types to be deleted. - * @param options The set of selected DialogOptions. - * @return int[] An array of data types that should be deleted - */ - protected int[] getDataTypesFromOptions(EnumSet<DialogOption> options) { - int[] dataTypes = new int[options.size()]; - int i = 0; - for (DialogOption option : options) { - dataTypes[i] = option.getDataType(); - ++i; - } - return dataTypes; - } - - /** * Notifies subclasses that browsing data is about to be cleared. */ protected void onClearBrowsingData() {} @@ -296,9 +333,9 @@ * Requests the browsing data corresponding to the given dialog options to be deleted. * @param options The dialog options whose corresponding data should be deleted. */ - private void clearBrowsingData(EnumSet<DialogOption> options, - @Nullable String[] blacklistedDomains, @Nullable int[] blacklistedDomainReasons, - @Nullable String[] ignoredDomains, @Nullable int[] ignoredDomainReasons) { + private void clearBrowsingData(ArraySet<Integer> options, @Nullable String[] blacklistedDomains, + @Nullable int[] blacklistedDomainReasons, @Nullable String[] ignoredDomains, + @Nullable int[] ignoredDomainReasons) { onClearBrowsingData(); showProgressDialog(); @@ -330,10 +367,10 @@ } /** - * Returns the Array of dialog options. Options are displayed in the same + * Returns the Array of {@link DialogOption}. Options are displayed in the same * order as they appear in the array. */ - abstract protected DialogOption[] getDialogOptions(); + abstract protected int[] getDialogOptions(); /** * Returns whether this preference page is a basic or advanced tab in order to use separate @@ -373,9 +410,9 @@ * @param option The option in question. * @return boolean Whether the given option should be preselected. */ - private boolean isOptionSelectedByDefault(DialogOption option) { + private boolean isOptionSelectedByDefault(@DialogOption int option) { return PrefServiceBridge.getInstance().getBrowsingDataDeletionPreference( - option.getDataType(), getPreferenceType()); + getDataType(option), getPreferenceType()); } /** @@ -417,7 +454,7 @@ * </ol> */ private boolean shouldShowImportantSitesDialog() { - EnumSet<DialogOption> selectedOptions = getSelectedOptions(); + ArraySet<Integer> selectedOptions = getSelectedOptions(); if (!selectedOptions.contains(DialogOption.CLEAR_CACHE) && !selectedOptions.contains(DialogOption.CLEAR_COOKIES_AND_SITE_DATA)) { return false; @@ -493,7 +530,7 @@ mDialogOpened = SystemClock.elapsedRealtime(); getActivity().setTitle(R.string.clear_browsing_data_title); PreferenceUtils.addPreferencesFromResource(this, getPreferenceXmlId()); - DialogOption[] options = getDialogOptions(); + int[] options = getDialogOptions(); mItems = new Item[options.length]; for (int i = 0; i < options.length; i++) { boolean enabled = true; @@ -504,25 +541,24 @@ Pref.ALLOW_DELETING_BROWSER_HISTORY)) { enabled = false; PrefServiceBridge.getInstance().setBrowsingDataDeletionPreference( - DialogOption.CLEAR_HISTORY.getDataType(), ClearBrowsingDataTab.BASIC, - false); + getDataType(DialogOption.CLEAR_HISTORY), ClearBrowsingDataTab.BASIC, false); PrefServiceBridge.getInstance().setBrowsingDataDeletionPreference( - DialogOption.CLEAR_HISTORY.getDataType(), ClearBrowsingDataTab.ADVANCED, + getDataType(DialogOption.CLEAR_HISTORY), ClearBrowsingDataTab.ADVANCED, false); } mItems[i] = new Item(getActivity(), this, options[i], (ClearBrowsingDataCheckBoxPreference) findPreference( - options[i].getPreferenceKey()), + getPreferenceKey(options[i])), isOptionSelectedByDefault(options[i]), enabled); } // Not all checkboxes defined in the layout are necessarily handled by this class // or a particular subclass. Hide those that are not. - EnumSet<DialogOption> unboundOptions = EnumSet.allOf(DialogOption.class); - unboundOptions.removeAll(Arrays.asList(getDialogOptions())); - for (DialogOption option : unboundOptions) { - getPreferenceScreen().removePreference(findPreference(option.getPreferenceKey())); + ArraySet<Integer> unboundOptions = getAllOptions(); + unboundOptions.removeAll(getSelectedOptions()); + for (@DialogOption Integer option : unboundOptions) { + getPreferenceScreen().removePreference(findPreference(getPreferenceKey(option))); } // The time range selection spinner.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesAdvanced.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesAdvanced.java index 14b86cc5..df04c59 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesAdvanced.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesAdvanced.java
@@ -19,11 +19,11 @@ } @Override - protected DialogOption[] getDialogOptions() { - return new DialogOption[] {DialogOption.CLEAR_HISTORY, - DialogOption.CLEAR_COOKIES_AND_SITE_DATA, DialogOption.CLEAR_CACHE, - DialogOption.CLEAR_PASSWORDS, DialogOption.CLEAR_FORM_DATA, - DialogOption.CLEAR_SITE_SETTINGS, DialogOption.CLEAR_MEDIA_LICENSES}; + protected int[] getDialogOptions() { + return new int[] {DialogOption.CLEAR_HISTORY, DialogOption.CLEAR_COOKIES_AND_SITE_DATA, + DialogOption.CLEAR_CACHE, DialogOption.CLEAR_PASSWORDS, + DialogOption.CLEAR_FORM_DATA, DialogOption.CLEAR_SITE_SETTINGS, + DialogOption.CLEAR_MEDIA_LICENSES}; } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasic.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasic.java index 02dd0e2..6dc0b9f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasic.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasic.java
@@ -5,6 +5,7 @@ package org.chromium.chrome.browser.preferences.privacy; import android.os.Bundle; +import android.support.v4.util.ArraySet; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; @@ -20,8 +21,6 @@ import org.chromium.components.sync.AndroidSyncSettings; import org.chromium.components.sync.ModelType; -import java.util.EnumSet; - /** * A simpler version of {@link ClearBrowsingDataPreferences} with fewer dialog options and more * explanatory text. @@ -32,9 +31,11 @@ super.onCreate(savedInstanceState); ClearBrowsingDataCheckBoxPreference historyCheckbox = - (ClearBrowsingDataCheckBoxPreference) findPreference(PREF_HISTORY); + (ClearBrowsingDataCheckBoxPreference) findPreference( + getPreferenceKey(DialogOption.CLEAR_HISTORY)); ClearBrowsingDataCheckBoxPreference cookiesCheckbox = - (ClearBrowsingDataCheckBoxPreference) findPreference(PREF_COOKIES); + (ClearBrowsingDataCheckBoxPreference) findPreference( + getPreferenceKey(DialogOption.CLEAR_COOKIES_AND_SITE_DATA)); historyCheckbox.setLinkClickDelegate(() -> { new TabDelegate(false /* incognito */) @@ -43,11 +44,9 @@ }); if (ChromeSigninController.get().isSignedIn()) { - if (isHistorySyncEnabled()) { - historyCheckbox.setSummary(R.string.clear_browsing_history_summary_synced); - } else { - historyCheckbox.setSummary(R.string.clear_browsing_history_summary_signed_in); - } + historyCheckbox.setSummary(isHistorySyncEnabled() + ? R.string.clear_browsing_history_summary_synced + : R.string.clear_browsing_history_summary_signed_in); } // On the basic tab the COOKIES checkbox includes Media Licenses, @@ -68,13 +67,13 @@ } @Override - protected DialogOption[] getDialogOptions() { - return new DialogOption[] {DialogOption.CLEAR_HISTORY, - DialogOption.CLEAR_COOKIES_AND_SITE_DATA, DialogOption.CLEAR_CACHE}; + protected int[] getDialogOptions() { + return new int[] {DialogOption.CLEAR_HISTORY, DialogOption.CLEAR_COOKIES_AND_SITE_DATA, + DialogOption.CLEAR_CACHE}; } @Override - protected int[] getDataTypesFromOptions(EnumSet<DialogOption> options) { + protected int[] getDataTypesFromOptions(ArraySet<Integer> options) { int[] dataTypes; int i = 0; if (options.contains(DialogOption.CLEAR_COOKIES_AND_SITE_DATA)) { @@ -86,8 +85,8 @@ } else { dataTypes = new int[options.size()]; } - for (DialogOption option : options) { - dataTypes[i++] = option.getDataType(); + for (Integer option : options) { + dataTypes[i++] = getDataType(option); } return dataTypes; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/previews/PreviewsAndroidBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/previews/PreviewsAndroidBridge.java index e6890488..3dd9627 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/previews/PreviewsAndroidBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/previews/PreviewsAndroidBridge.java
@@ -29,7 +29,21 @@ return nativeShouldShowPreviewUI(mNativePreviewsAndroidBridge, webContents); } + public String getOriginalHost(WebContents webContents) { + assert shouldShowPreviewUI(webContents) : "getOriginalHost called on a non-preview page"; + return nativeGetOriginalHost(mNativePreviewsAndroidBridge, webContents); + } + + public void loadOriginal(WebContents webContents) { + assert shouldShowPreviewUI(webContents) : "loadOriginal called on a non-preview page"; + nativeLoadOriginal(mNativePreviewsAndroidBridge, webContents); + } + private native long nativeInit(); private native boolean nativeShouldShowPreviewUI( long nativePreviewsAndroidBridge, WebContents webContents); + private native String nativeGetOriginalHost( + long nativePreviewsAndroidBridge, WebContents webContents); + private native void nativeLoadOriginal( + long nativePreviewsAndroidBridge, WebContents webContents); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/OAuth2TokenService.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/OAuth2TokenService.java index 927e7bc..aa55ba98 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/OAuth2TokenService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/OAuth2TokenService.java
@@ -224,6 +224,10 @@ */ @CalledByNative public static boolean hasOAuth2RefreshToken(String accountName) { + if (!AccountManagerFacade.get().isCachePopulated()) { + return false; + } + // Temporarily allowing disk read while fixing. TODO: http://crbug.com/618096. // This function is called in RefreshTokenIsAvailable of OAuth2TokenService which is // expected to be called in the UI thread synchronously.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/snackbar/smartlockautosignin/AutoSigninSnackbarController.java b/chrome/android/java/src/org/chromium/chrome/browser/snackbar/smartlockautosignin/AutoSigninSnackbarController.java index 1e7b8ff5..676b3cf41 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/snackbar/smartlockautosignin/AutoSigninSnackbarController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/snackbar/smartlockautosignin/AutoSigninSnackbarController.java
@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.snackbar.SnackbarManager; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; /** @@ -60,7 +61,7 @@ mSnackbarManager = snackbarManager; mTabObserver = new EmptyTabObserver() { @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { AutoSigninSnackbarController.this.dismissAutoSigninSnackbar(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/NavigationRecorder.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/NavigationRecorder.java index 08cb9ea..ddae661d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/NavigationRecorder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/NavigationRecorder.java
@@ -10,13 +10,14 @@ import org.chromium.base.Callback; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.NavigationController; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContentsObserver; import org.chromium.ui.base.PageTransition; - /** * Records stats related to a page visit, such as the time spent on the website, or if the user * comes back to the starting point. Use through {@link #record(Tab, Callback)}. @@ -69,12 +70,12 @@ } @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { if (mStartTimeMs == 0) mStartTimeMs = SystemClock.elapsedRealtime(); } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { endRecording(tab, null); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/survey/ChromeSurveyController.java b/chrome/android/java/src/org/chromium/chrome/browser/survey/ChromeSurveyController.java index 6f761a0..b7de6fb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/survey/ChromeSurveyController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/survey/ChromeSurveyController.java
@@ -29,6 +29,7 @@ import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelector; @@ -238,7 +239,7 @@ } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { // An infobar shouldn't appear on a tab that the user left. tab.removeObserver(this); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/ChildBackgroundTabShowObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/ChildBackgroundTabShowObserver.java index c026c59..5481852 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/ChildBackgroundTabShowObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/ChildBackgroundTabShowObserver.java
@@ -5,6 +5,7 @@ package org.chromium.chrome.browser.tab; import org.chromium.base.metrics.RecordHistogram; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import java.util.ArrayList; @@ -44,7 +45,7 @@ } @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { int rank = mTabCreationOrder.indexOf(tab); int reverseRank = mTabCreationOrder.size() - rank - 1;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/EmptyTabObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/EmptyTabObserver.java index b1f874a..2c28ce1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/EmptyTabObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/EmptyTabObserver.java
@@ -8,6 +8,8 @@ import android.view.ContextMenu; import org.chromium.chrome.browser.fullscreen.FullscreenOptions; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.common.BrowserControlsState; @@ -19,12 +21,11 @@ * bloats the number of methods. See https://crbug.com/781359. */ public class EmptyTabObserver implements TabObserver { + @Override + public void onShown(Tab tab, @TabSelectionType int type) {} @Override - public void onShown(Tab tab) { } - - @Override - public void onHidden(Tab tab) { } + public void onHidden(Tab tab, @TabHidingType int reason) {} @Override public void onClosingStateChanged(Tab tab, boolean closing) { } @@ -48,6 +49,9 @@ public void onPageLoadFailed(Tab tab, int errorCode) { } @Override + public void onRestoreStarted(Tab tab) {} + + @Override public void onFaviconUpdated(Tab tab, Bitmap icon) { } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java index b9d10bb..6a59e26 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -16,6 +16,7 @@ import android.net.Uri; import android.os.Bundle; import android.provider.Browser; +import android.support.annotation.IntDef; import android.support.annotation.Nullable; import android.text.TextUtils; import android.view.ContextThemeWrapper; @@ -122,6 +123,8 @@ import org.chromium.ui.widget.AnchoredPopupWindow; import org.chromium.ui.widget.ViewRectProvider; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.lang.ref.WeakReference; import java.nio.ByteBuffer; import java.util.List; @@ -161,6 +164,22 @@ private static final String PRODUCT_VERSION = ChromeVersionInfo.getProductVersion(); + /** + * A list of the various ways tabs can be hidden. + */ + @IntDef({TabHidingType.CHANGED_TABS, TabHidingType.ACTIVITY_HIDDEN, TabHidingType.REPARENTED}) + @Retention(RetentionPolicy.SOURCE) + public @interface TabHidingType { + /** A tab was hidden due to other tab getting foreground. */ + int CHANGED_TABS = 0; + + /** A tab was hidden together with an activity. */ + int ACTIVITY_HIDDEN = 1; + + /** A tab was hidden while being reparented to a new activity. */ + int REPARENTED = 2; + } + private long mNativeTabAndroid; /** Unique id of this tab (within its container). */ @@ -352,12 +371,6 @@ private boolean mIsDetached; /** - * The UMA object used to report stats for this tab. Note that this may be null under certain - * conditions, such as incognito mode. - */ - private TabUma mTabUma; - - /** * Reference to the current sadTabView if one is defined. */ private View mSadTabView; @@ -583,7 +596,7 @@ MediaSessionTabHelper.createForTab(this); if (creationState != null) { - mTabUma = new TabUma(creationState); + TabUma.create(this, creationState); if (frozenState == null) { assert creationState != TabCreationState.FROZEN_ON_RESTORE; } else { @@ -1172,9 +1185,7 @@ * Called on the foreground tab when the Activity showing the Tab gets stopped. */ public void onActivityHidden() { - hide(); - - if (mTabUma != null) mTabUma.onActivityHidden(); + hide(TabHidingType.ACTIVITY_HIDDEN); } /** @@ -1205,11 +1216,6 @@ if (getWebContents() != null) getWebContents().onShow(); - if (mTabUma != null) { - mTabUma.onShow(type, getTimestampMillis(), - computeMRURank(this, getTabModelSelector().getModel(mIncognito))); - } - // If the NativePage was frozen while in the background (see NativePageAssassin), // recreate the NativePage now. NativePage nativePage = getNativePage(); @@ -1224,11 +1230,11 @@ notifyLoadProgress(getProgress()); } + for (TabObserver observer : mObservers) observer.onShown(this, type); + // Updating the timestamp has to happen after the showInternal() call since subclasses // may use it for logging. mTimestampMillis = System.currentTimeMillis(); - - for (TabObserver observer : mObservers) observer.onShown(this); } finally { TraceEvent.end("Tab.show"); } @@ -1237,7 +1243,7 @@ /** * Triggers the hiding logic for the view backing the tab. */ - public final void hide() { + public final void hide(@TabHidingType int type) { try { TraceEvent.begin("Tab.hide"); if (isHidden()) return; @@ -1251,12 +1257,10 @@ mFullscreenManager.exitPersistentFullscreenMode(); } - if (mTabUma != null) mTabUma.onHide(); - // Allow this tab's NativePage to be frozen if it stays hidden for a while. NativePageAssassin.getInstance().tabHidden(this); - for (TabObserver observer : mObservers) observer.onHidden(this); + for (TabObserver observer : mObservers) observer.onHidden(this, type); } finally { TraceEvent.end("Tab.hide"); } @@ -1397,7 +1401,7 @@ // TODO(peconn): Figure out why this is necessary - it is something to do with // Tab.mIsDetached being true and TabModelSelectorImpl#requestToShowTab not calling // |mVisibleTab.hide()| because of it. - hide(); + hide(TabHidingType.REPARENTED); attachAndFinishReparenting(activity, tabDelegateFactory, null); } @@ -1619,8 +1623,6 @@ if (mIsRendererUnresponsive) handleRendererResponsiveStateChanged(true); - if (mTabUma != null) mTabUma.onPageLoadStarted(); - for (TabObserver observer : mObservers) observer.onPageLoadStarted(this, validatedUrl); } @@ -1635,8 +1637,6 @@ // Reset the succressiveRefresh counter after successfully loading a page. mSadTabSuccessiveRefreshCounter = 0; - if (mTabUma != null) mTabUma.onPageLoadFinished(); - for (TabObserver observer : mObservers) observer.onPageLoadFinished(this); mIsBeingRestored = false; @@ -1689,7 +1689,6 @@ * @param errorCode The error code causing the page to fail loading. */ protected void didFailPageLoad(int errorCode) { - if (mTabUma != null) mTabUma.onLoadFailed(errorCode); for (TabObserver observer : mObservers) { observer.onPageLoadFailed(this, errorCode); } @@ -1967,8 +1966,6 @@ // Update the title before destroying the tab. http://b/5783092 updateTitle(); - if (mTabUma != null) mTabUma.onDestroy(); - for (TabObserver observer : mObservers) observer.onDestroyed(this); mObservers.clear(); @@ -2147,7 +2144,7 @@ loadIfNecessary(); mIsBeingRestored = true; - if (mTabUma != null) mTabUma.onRestoreStarted(); + for (TabObserver observer : mObservers) observer.onRestoreStarted(this); } finally { TraceEvent.end("Tab.restoreIfNeeded"); } @@ -2183,7 +2180,7 @@ // that can be done at this point. TODO(jcivelli) http://b/5910521 - we should show // an error page instead of a blank page in that case (and the last loaded URL). webContents = WebContentsFactory.createWebContents(isIncognito(), isHidden()); - mTabUma = new TabUma(TabCreationState.FROZEN_ON_RESTORE_FAILED); + TabUma.create(this, TabCreationState.FROZEN_ON_RESTORE_FAILED); mFailedToRestore = true; } View compositorView = getActivity().getCompositorViewHolder(); @@ -2606,7 +2603,7 @@ /** * @return See {@link #mTimestampMillis}. */ - private long getTimestampMillis() { + long getTimestampMillis() { return mTimestampMillis; } @@ -2763,13 +2760,9 @@ void handleTabCrash() { mIsLoading = false; - if (mTabUma != null) mTabUma.onRendererCrashed(); - boolean sadTabShown = isShowingSadTab(); RewindableIterator<TabObserver> observers = getTabObservers(); - while (observers.hasNext()) { - observers.next().onCrash(this, sadTabShown); - } + while (observers.hasNext()) observers.next().onCrash(this, sadTabShown); mIsBeingRestored = false; } @@ -2980,30 +2973,6 @@ } /** - * @return the UMA object for the tab. Note that this may be null in some - * cases. - */ - public TabUma getTabUma() { - return mTabUma; - } - - /** - * @return The most recently used rank for this tab in the given TabModel. - */ - private static int computeMRURank(Tab tab, TabModel model) { - final long tabLastShow = tab.getTabUma().getLastShownTimestamp(); - int mruRank = 0; - for (int i = 0; i < model.getCount(); i++) { - Tab otherTab = model.getTabAt(i); - if (otherTab != tab && otherTab.getTabUma() != null - && otherTab.getTabUma().getLastShownTimestamp() > tabLastShow) { - mruRank++; - } - } - return mruRank; - } - - /** * Sets the Intent that can be fired to restart the Activity of this Tab's parent. * Should only be called if the Tab was launched via a different Activity. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java index 1464b9c1..228eed5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java
@@ -172,13 +172,8 @@ RecordUserAction.record("MobileNewTabOpened"); LoadUrlParams loadUrlParams = new LoadUrlParams(url); loadUrlParams.setReferrer(referrer); - Tab newTab = mTab.getTabModelSelector().openNewTab( + mTab.getTabModelSelector().openNewTab( loadUrlParams, TabLaunchType.FROM_LONGPRESS_BACKGROUND, mTab, isIncognito()); - - // {@code newTab} is null in document mode. Do not record metrics for document mode. - if (mTab.getTabUma() != null && newTab != null) { - mTab.getTabUma().onBackgroundTabOpenedFromContextMenu(newTab); - } } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabObserver.java index 04c9d72..65b8af8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabObserver.java
@@ -10,6 +10,8 @@ import org.chromium.chrome.browser.TabLoadStatus; import org.chromium.chrome.browser.fullscreen.FullscreenOptions; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.common.BrowserControlsState; @@ -18,18 +20,19 @@ * An observer that is notified of changes to a {@link Tab} object. */ public interface TabObserver { - /** * Called when a {@link Tab} is shown. * @param tab The notifying {@link Tab}. + * @param type Specifies how the tab was selected. */ - void onShown(Tab tab); + void onShown(Tab tab, @TabSelectionType int type); /** * Called when a {@link Tab} is hidden. * @param tab The notifying {@link Tab}. + * @param type Specifies how the tab was hidden. */ - void onHidden(Tab tab); + void onHidden(Tab tab, @TabHidingType int type); /** * Called when a {@link Tab}'s closing state has changed. @@ -127,6 +130,12 @@ void onCrash(Tab tab, boolean sadTabShown); /** + * Called when restore of the corresponding tab is triggered. + * @param tab The notifying {@link Tab}. + */ + void onRestoreStarted(Tab tab); + + /** * Called when the WebContents of a {@link Tab} have been swapped. * @param tab The notifying {@link Tab}. * @param didStartLoad Whether WebContentsObserver::DidStartProvisionalLoadForFrame() has
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java index 22900f9..c505200 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java
@@ -18,6 +18,7 @@ import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.LaunchIntentDispatcher; import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.util.IntentUtils; import org.chromium.ui.base.PageTransition; @@ -109,7 +110,7 @@ } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { clear(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabStateBrowserControlsVisibilityDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabStateBrowserControlsVisibilityDelegate.java index a8b0aef8..82f90f7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabStateBrowserControlsVisibilityDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabStateBrowserControlsVisibilityDelegate.java
@@ -10,6 +10,7 @@ import org.chromium.chrome.browser.UrlConstants; import org.chromium.chrome.browser.device.DeviceClassManager; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.util.AccessibilityUtil; import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; import org.chromium.components.security_state.ConnectionSecurityLevel; @@ -116,7 +117,7 @@ } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { cancelEnableFullscreenLoadDelay(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabUma.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabUma.java index 5e3189c..6a42d31 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabUma.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabUma.java
@@ -7,8 +7,14 @@ import android.os.SystemClock; import android.support.annotation.IntDef; +import org.chromium.base.UserData; import org.chromium.base.metrics.RecordHistogram; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; +import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; +import org.chromium.chrome.browser.tabmodel.TabModel; +import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; +import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; import org.chromium.net.NetError; import java.lang.annotation.Retention; @@ -21,7 +27,9 @@ * eviction. * All calls must be made from the UI thread. */ -public class TabUma { +public class TabUma extends EmptyTabObserver implements UserData { + private static final Class<TabUma> USER_DATA_KEY = TabUma.class; + // TabStatus defined in tools/metrics/histograms/histograms.xml. static final int TAB_STATUS_MEMORY_RESIDENT = 0; static final int TAB_STATUS_RELOAD_EVICTED = 1; @@ -93,11 +101,25 @@ // first. private ChildBackgroundTabShowObserver mChildBackgroundTabShowObserver; + private TabModelSelectorObserver mNewTabObserver; + + static TabUma create(Tab tab, @TabCreationState int creationState) { + TabUma tabUma = get(tab); + if (tabUma != null) tabUma.removeObservers(tab); + + return tab.getUserDataHost().setUserData(USER_DATA_KEY, new TabUma(tab, creationState)); + } + + private static TabUma get(Tab tab) { + return tab.getUserDataHost().getUserData(USER_DATA_KEY); + } + /** * Constructs a new UMA tracker for a specific tab. + * @param Tab The Tab being monitored for stats. * @param creationState In what state the tab was created. */ - public TabUma(@TabCreationState int creationState) { + private TabUma(Tab tab, @TabCreationState int creationState) { mTabCreationState = creationState; mLastTabStateChangeMillis = System.currentTimeMillis(); @@ -115,6 +137,7 @@ case TabCreationState.FROZEN_FOR_LAZY_LOAD: updateTabState(TAB_STATE_INACTIVE); } + tab.addObserver(this); } /** @@ -191,7 +214,7 @@ * Updates saved TabState and its timestamp. Records the state transition into the histogram. * @param newState New state of the tab. */ - void updateTabState(int newState) { + private void updateTabState(int newState) { if (mLastTabState == newState) { return; } @@ -202,14 +225,27 @@ } /** - * Called upon tab display. - * @param selectionType determines how the tab was being shown - * @param previousTimestampMillis time of the previous display or creation time for the tabs - * opened in background and not yet displayed - * @param rank The MRU rank for this tab within the model. + * @return The most recently used rank for this tab in the given TabModel. */ - void onShow(@TabSelectionType int selectionType, long previousTimestampMillis, int rank) { + private static int computeMRURank(Tab tab, TabModel model) { + final long tabLastShow = get(tab).getLastShownTimestamp(); + int mruRank = 0; + for (int i = 0; i < model.getCount(); i++) { + Tab otherTab = model.getTabAt(i); + if (otherTab != tab && TabUma.get(otherTab) != null + && TabUma.get(otherTab).getLastShownTimestamp() > tabLastShow) { + mruRank++; + } + } + return mruRank; + } + + @Override + public void onShown(Tab tab, @TabSelectionType int selectionType) { + int rank = computeMRURank(tab, tab.getTabModelSelector().getModel(tab.isIncognito())); + long previousTimestampMillis = tab.getTimestampMillis(); long now = SystemClock.elapsedRealtime(); + // Do not collect the tab switching data for the first switch to a tab after the cold start // and for the tab switches that were not user-originated (e.g. the user closes the last // incognito tab and the current normal mode tab is shown). @@ -254,8 +290,8 @@ "Tab.StatusWhenSwitchedBackToForeground", status, TAB_STATUS_LIM); } - // Record Tab.BackgroundLoadStatus. if (mLastShownTimestamp == -1) { + // Record Tab.BackgroundLoadStatus. if (mTabCreationState == TabCreationState.LIVE_IN_BACKGROUND) { if (mRestoreStartedAtMillis == -1) { RecordHistogram.recordEnumeratedHistogram("Tab.BackgroundLoadStatus", @@ -276,6 +312,19 @@ RecordHistogram.recordEnumeratedHistogram("Tab.BackgroundLoadStatus", TAB_BACKGROUND_LOAD_SKIPPED, TAB_BACKGROUND_LOAD_LIM); } + + // Register the observer for context menu-triggering event here to avoid the case + // where this is created too early and we start missing out on metrics suddenly. + mNewTabObserver = new EmptyTabModelSelectorObserver() { + @Override + public void onNewTabCreated(Tab newTab) { + if (newTab.getParentId() == tab.getId() + && newTab.getLaunchType() == TabLaunchType.FROM_LONGPRESS_BACKGROUND) { + onBackgroundTabOpenedFromContextMenu(newTab); + } + } + }; + tab.getTabModelSelector().addObserver(mNewTabObserver); } // Record "tab age upon first display" metrics. previousTimestampMillis is persisted through @@ -297,16 +346,19 @@ updateTabState(TAB_STATE_ACTIVE); } - void onHide() { - updateTabState(TAB_STATE_INACTIVE); + // TabObserver + + @Override + public void onHidden(Tab tab, @TabHidingType int type) { + if (type == TabHidingType.ACTIVITY_HIDDEN) { + recordNumBackgroundTabsOpened(); + } else { + updateTabState(TAB_STATE_INACTIVE); + } } - /** Called when the corresponding activity is stopped. */ - void onActivityHidden() { - recordNumBackgroundTabsOpened(); - } - - void onDestroy() { + @Override + public void onDestroyed(Tab tab) { updateTabState(TAB_STATE_CLOSED); if (mTabCreationState == TabCreationState.LIVE_IN_BACKGROUND @@ -316,20 +368,28 @@ } recordNumBackgroundTabsOpened(); + removeObservers(tab); } - /** Called when restore of the corresponding tab is triggered. */ - void onRestoreStarted() { + private void removeObservers(Tab tab) { + if (mNewTabObserver != null) tab.getTabModelSelector().removeObserver(mNewTabObserver); + tab.removeObserver(this); + } + + @Override + public void onRestoreStarted(Tab tab) { mRestoreStartedAtMillis = SystemClock.elapsedRealtime(); } /** Called when the corresponding tab starts a page load. */ - void onPageLoadStarted() { + @Override + public void onPageLoadStarted(Tab tab, String url) { recordNumBackgroundTabsOpened(); } /** Called when the correspoding tab completes a page load. */ - void onPageLoadFinished() { + @Override + public void onPageLoadFinished(Tab tab) { // Record only tab restores that the user became aware of. If the restore is triggered // speculatively and completes before the user switches to the tab, then this case is // reflected in Tab.StatusWhenSwitchedBackToForeground metric. @@ -343,7 +403,8 @@ } /** Called when the correspoding tab fails a page load. */ - void onLoadFailed(int errorCode) { + @Override + public void onPageLoadFailed(Tab tab, int errorCode) { if (mRestoreStartedAtMillis != -1 && mLastShownTimestamp >= mRestoreStartedAtMillis) { // Load time is ignored for failed loads. recordTabRestoreResult(false, -1, -1, errorCode); @@ -352,7 +413,8 @@ } /** Called when the renderer of the correspoding tab crashes. */ - void onRendererCrashed() { + @Override + public void onCrash(Tab tab, boolean sadTabShown) { if (mRestoreStartedAtMillis != -1) { // TODO(ppi): Add a bucket in Tab.RestoreResult for restores failed due to // renderer crashes and start to track that. @@ -365,7 +427,7 @@ * from the context menu. * @param backgroundTab The background tab. */ - void onBackgroundTabOpenedFromContextMenu(Tab backgroundTab) { + private void onBackgroundTabOpenedFromContextMenu(Tab backgroundTab) { ++mNumBackgroundTabsOpened; if (mChildBackgroundTabShowObserver == null) { @@ -378,7 +440,7 @@ /** * @return The timestamp for when this tab was last shown. */ - long getLastShownTimestamp() { + private long getLastShownTimestamp() { return mLastShownTimestamp; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java index c4ab7f8..be9ed550 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java
@@ -11,6 +11,7 @@ import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabPersistentStore.TabPersistentStoreObserver; @@ -356,7 +357,7 @@ && (!isFromExternalApp || type != TabSelectionType.FROM_NEW)) { cacheTabBitmap(mVisibleTab); } - mVisibleTab.hide(); + mVisibleTab.hide(TabHidingType.CHANGED_TABS); mTabSaver.addTabToSaveQueue(mVisibleTab); } tabToDropImportance = mVisibleTab;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java index 4ac117bf..56ded1b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java
@@ -385,7 +385,7 @@ } @Override - public void onShown(Tab tab) { + public void onShown(Tab tab, @TabSelectionType int type) { if (TextUtils.isEmpty(tab.getUrl())) return; mControlContainer.setReadyForBitmapCapture(true); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java index ebc7452..396dab2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java
@@ -315,6 +315,31 @@ * @return Whether a slimmer peek UI should be used for this content. */ boolean useSlimPeek(); + + /** + * @return The resource id of the content description for the bottom sheet. This is + * generally the name of the feature/content that is showing. 'Swipe down to close.' + * will be automatically appended after the content description. + */ + int getSheetContentDescriptionStringId(); + + /** + * @return The resource id of the string announced when the sheet is opened at half height. + * This is typically the name of your feature followed by 'opened at half height'. + */ + int getSheetHalfHeightAccessibilityStringId(); + + /** + * @return The resource id of the string announced when the sheet is opened at full height. + * This is typically the name of your feature followed by 'opened at full height'. + */ + int getSheetFullHeightAccessibilityStringId(); + + /** + * @return The resource id of the string announced when the sheet is closed. This is + * typically the name of your feature followed by 'closed'. + */ + int getSheetClosedAccessibilityStringId(); } /** @@ -997,7 +1022,8 @@ mPersistentControlsToken); for (BottomSheetObserver o : mObservers) o.onSheetClosed(reason); - announceForAccessibility(getResources().getString(R.string.bottom_sheet_closed)); + announceForAccessibility(getResources().getString( + getCurrentSheetContent().getSheetClosedAccessibilityStringId())); clearFocus(); mActivity.removeViewObscuringAllTabs(this); @@ -1322,16 +1348,21 @@ mCurrentState = state; if (mCurrentState == SheetState.HALF || mCurrentState == SheetState.FULL) { - announceForAccessibility(mCurrentState == SheetState.FULL - ? getResources().getString(R.string.bottom_sheet_opened_full) - : getResources().getString(R.string.bottom_sheet_opened_half)); + int resId = mCurrentState == SheetState.FULL + ? getCurrentSheetContent().getSheetFullHeightAccessibilityStringId() + : getCurrentSheetContent().getSheetHalfHeightAccessibilityStringId(); + announceForAccessibility(getResources().getString(resId)); // TalkBack will announce the content description if it has changed, so wait to set the // content description until after announcing full/half height. setFocusable(true); setFocusableInTouchMode(true); + String swipeToClose = ". " + + getResources().getString(R.string.bottom_sheet_accessibility_description); setContentDescription( - getResources().getString(R.string.bottom_sheet_accessibility_description)); + getResources().getString( + getCurrentSheetContent().getSheetContentDescriptionStringId()) + + swipeToClose); if (getFocusedChild() == null) requestFocus(); }
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd index 54b7319..69de655 100644 --- a/chrome/android/java/strings/android_chrome_strings.grd +++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -2219,6 +2219,12 @@ <message name="IDS_PAGE_INFO_OPEN_ONLINE_BUTTON" desc="Text in the button that attempts to open an online version of the offline website displayed in the tab."> Open Online </message> + <message name="IDS_PAGE_INFO_PREVIEW_MESSAGE" desc="This text is displayed in the page info bubble when the currently viewed page has been modified by Google to be a lighter and faster version of the original page. The word 'Lite' should match the translation in TC ID 1019734090540434451"> + Lite page delivered by Google. + </message> + <message name="IDS_PAGE_INFO_PREVIEW_LOAD_ORIGINAL" desc="This text, when clicked, loads the original page from its origin without any treatments. This text is shown in the page info bubble when the currently viewed page has been modified to be a lighter and faster version of the original page."> + <ph name="BEGIN_LINK"><link></ph>Load original page<ph name="END_LINK"></link></ph> from <ph name="DOMAIN_NAME">%1$s<ex>google.com</ex></ph> + </message> <!-- Sad tab page --> <message name="IDS_SAD_TAB_SUGGESTIONS" desc="The help message displayed on the sad tab page after a tab crashes."> @@ -2827,12 +2833,27 @@ </message> <!-- Contextual suggestions strings --> - <message name="IDS_CONTEXTUAL_SUGGESTIONS_IN_PRODUCT_HELP" desc="The string displayed in an in-product help bubble when contextual suggestions are displayed for the first time. The bubble points to a swipeable panel containing suggestions related to the webpage the user is currently viewing."> + <message name="IDS_CONTEXTUAL_SUGGESTIONS_IN_PRODUCT_HELP" desc="The string displayed in an in-product help bubble when contextual suggestions are displayed for the first time. The bubble points to a toolbar button that shows suggestions related to the webpage the user is currently viewing when pressed."> See more like this from Google </message> + <message name="IDS_CONTEXTUAL_SUGGESTIONS_IN_PRODUCT_HELP_ACCESSIBILITY" desc="The string displayed in an in-product help bubble when contextual suggestions are displayed for the first time and accessibility mode is enabled. The bubble points to a toolbar button that shows suggestions related to the webpage the user is currently viewing when pressed."> + See more like this from Google using the More Like This button + </message> <message name="IDS_CONTEXTUAL_SUGGESTIONS_BUTTON_DESCRIPTION" desc="The content description for a toolbar button that shows contextual suggestions related to the current web page when tapped. 'More like this' should be the same as in the contextual_suggestions_in_product_help string."> More like this </message> + <message name="IDS_CONTEXTUAL_SUGGESTIONS_CLOSE_BUTTON_DESCRIPTION" desc="The content description for the contextual suggestions close button. Tapping the button closing the UI. 'More like this' should be the same as in the contextual_suggestions_in_product_help string."> + Close more like this + </message> + <message name="IDS_CONTEXTUAL_SUGGESTIONS_SHEET_OPENED_HALF" desc="Accessibility string read when the 'more like this' sheet is opened at half height. The sheet will occupy the bottom half the screen. 'More like this' should be the same as in the contextual_suggestions_in_product_help string"> + More like this opened at half height + </message> + <message name="IDS_CONTEXTUAL_SUGGESTIONS_SHEET_OPENED_FULL" desc="Accessibility string read when the 'more like this' sheet is opened at full height. The sheet will occupy the entire screen. 'More like this' should be the same as in the contextual_suggestions_in_product_help string"> + More like this opened at full height + </message> + <message name="IDS_CONTEXTUAL_SUGGESTIONS_SHEET_CLOSED" desc="Accessibility string read when the'more like this' sheet is closed. 'More like this' should be the same as in the contextual_suggestions_in_product_help string"> + More like this closed + </message> <!-- Toolbar button strings --> <message name="IDS_OPEN_TABS" desc="Text for button to enter the tab switcher and show tabs that are open on this device"> @@ -3723,18 +3744,9 @@ Remove and recreate this shortcut </message> - <!-- Chrome Home --> - <message name="IDS_BOTTOM_SHEET_ACCESSIBILITY_DESCRIPTION" desc="Accessibility string read when the navigation panel is focused informing the user that the panel can be closed by swiping down."> - Navigation panel. Swipe down to close. - </message> - <message name="IDS_BOTTOM_SHEET_OPENED_HALF" desc="Accessibility string read when the bottom navigation panel is opened at half height. The navigation panel will occupy the bottom half the screen."> - Navigation panel opened at half height - </message> - <message name="IDS_BOTTOM_SHEET_OPENED_FULL" desc="Accessibility string read when the bottom navigation panel is opened at full height. The navigation panel will occupy the entire screen."> - Navigation panel opened at full height - </message> - <message name="IDS_BOTTOM_SHEET_CLOSED" desc="Accessibility string read when the bottom navigation panel is closed."> - Navigation panel closed + <!-- BottomSheet --> + <message name="IDS_BOTTOM_SHEET_ACCESSIBILITY_DESCRIPTION" desc="Accessibility string read when the bottom sheet is focused informing the user that the sheet can be closed by swiping down."> + Swipe down to close. </message> <!-- Chrome Duet -->
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_BUTTON_DESCRIPTION.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_BUTTON_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..18ae295 --- /dev/null +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_BUTTON_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +e180c363bbba530a91d945d39c47835d87c64115 \ No newline at end of file
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_CLOSE_BUTTON_DESCRIPTION.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_CLOSE_BUTTON_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..e2162bc --- /dev/null +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_CLOSE_BUTTON_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +e9b1dec493050b4678384f62961f3274b0cb7369 \ No newline at end of file
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_IN_PRODUCT_HELP.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_IN_PRODUCT_HELP.png.sha1 new file mode 100644 index 0000000..a4e237d --- /dev/null +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_IN_PRODUCT_HELP.png.sha1
@@ -0,0 +1 @@ +df3426b60fe91981e35de68a882715da0c48095b \ No newline at end of file
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_IN_PRODUCT_HELP_ACCESSIBILITY.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_IN_PRODUCT_HELP_ACCESSIBILITY.png.sha1 new file mode 100644 index 0000000..ad7f62e8 --- /dev/null +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_IN_PRODUCT_HELP_ACCESSIBILITY.png.sha1
@@ -0,0 +1 @@ +8b4de0819831b4b16c2184a7a08f783801533770 \ No newline at end of file
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_SHEET_OPENED_FULL.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_SHEET_OPENED_FULL.png.sha1 new file mode 100644 index 0000000..cb775b2 --- /dev/null +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_SHEET_OPENED_FULL.png.sha1
@@ -0,0 +1 @@ +e00c4d48416cdb05da591dc4a18189f6380f7442 \ No newline at end of file
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_SHEET_OPENED_HALF.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_SHEET_OPENED_HALF.png.sha1 new file mode 100644 index 0000000..6c22983a --- /dev/null +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTUAL_SUGGESTIONS_SHEET_OPENED_HALF.png.sha1
@@ -0,0 +1 @@ +b1ce64aec1128e5568804db165c0173f017f38e6 \ No newline at end of file
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OWNERS b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OWNERS new file mode 100644 index 0000000..db00700 --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OWNERS
@@ -0,0 +1 @@ +file://chrome/android/java/src/org/chromium/chrome/browser/browserservices/OWNERS
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextual_suggestions/EmptyEnabledStateMonitor.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextual_suggestions/EmptyEnabledStateMonitor.java index a3b99b5e..6edcebf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextual_suggestions/EmptyEnabledStateMonitor.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextual_suggestions/EmptyEnabledStateMonitor.java
@@ -21,7 +21,4 @@ public boolean getEnabledState() { return false; } - - @Override - public void onAccessibilityModeChanged() {} }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java index 4dbd484..3f24c62 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -95,6 +95,7 @@ import org.chromium.chrome.browser.preferences.PrefServiceBridge; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tab.TabTestUtils; import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; @@ -2554,7 +2555,7 @@ final CallbackHelper tabHiddenHelper = new CallbackHelper(); TabObserver observer = new EmptyTabObserver() { @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { tabHiddenHelper.notifyCalled(); } };
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java index 1e28e1c..570c9f66 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java
@@ -22,6 +22,7 @@ import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.common.ContentSwitches; import org.chromium.net.test.EmbeddedTestServer; import org.chromium.ui.base.PageTransition; @@ -78,8 +79,9 @@ testUrl, PageTransition.TYPED, mActivityTestRule.getActivity().getActivityTab()); ThreadUtils.runOnUiThreadBlocking(() -> { PageInfoController pageInfo = new PageInfoController(mActivityTestRule.getActivity(), - mActivityTestRule.getActivity().getActivityTab(), null, null, - PageInfoController.OfflinePageState.NOT_OFFLINE_PAGE, null); + mActivityTestRule.getActivity().getActivityTab(), ConnectionSecurityLevel.NONE, + null, null, PageInfoController.OfflinePageState.NOT_OFFLINE_PAGE, null, + PageInfoController.PreviewPageState.NOT_PREVIEW, null); PageInfoView pageInfoView = pageInfo.getPageInfoViewForTesting(); // Test that the title contains the Unicode hostname rather than strict equality, as // the test server will be bound to a random port.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java index 820ca74..f6233a7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java
@@ -26,6 +26,7 @@ import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.preferences.Preferences; +import org.chromium.chrome.browser.preferences.privacy.ClearBrowsingDataPreferences.DialogOption; import org.chromium.chrome.browser.sync.ProfileSyncService; import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; @@ -72,11 +73,8 @@ @Override public Set<Integer> getActiveDataTypes() { - if (mSyncable) { - return CollectionUtil.newHashSet(ModelType.HISTORY_DELETE_DIRECTIVES); - } else { - return new HashSet<Integer>(); - } + return mSyncable ? CollectionUtil.newHashSet(ModelType.HISTORY_DELETE_DIRECTIVES) + : new HashSet<Integer>(); } } @@ -122,10 +120,11 @@ (ClearBrowsingDataPreferencesBasic) preferences.getFragmentForTest(); PreferenceScreen screen = fragment.getPreferenceScreen(); - String cookiesSummary = - getCheckboxSummary(screen, ClearBrowsingDataPreferencesBasic.PREF_COOKIES); - String historySummary = - getCheckboxSummary(screen, ClearBrowsingDataPreferencesBasic.PREF_HISTORY); + String cookiesSummary = getCheckboxSummary(screen, + ClearBrowsingDataPreferences.getPreferenceKey( + DialogOption.CLEAR_COOKIES_AND_SITE_DATA)); + String historySummary = getCheckboxSummary(screen, + ClearBrowsingDataPreferences.getPreferenceKey(DialogOption.CLEAR_HISTORY)); assertThat(cookiesSummary, not(containsString(GOOGLE_ACCOUNT))); assertThat(historySummary, not(containsString(OTHER_ACTIVITY))); @@ -154,8 +153,8 @@ (ClearBrowsingDataPreferencesBasic) preferences.getFragmentForTest(); PreferenceScreen screen = fragment.getPreferenceScreen(); - String historySummary = - getCheckboxSummary(screen, ClearBrowsingDataPreferencesBasic.PREF_HISTORY); + String historySummary = getCheckboxSummary(screen, + ClearBrowsingDataPreferences.getPreferenceKey(DialogOption.CLEAR_HISTORY)); assertThat(historySummary, containsString(OTHER_ACTIVITY)); assertThat(historySummary, not(containsString(SIGNED_IN_DEVICES))); @@ -183,8 +182,8 @@ (ClearBrowsingDataPreferencesBasic) preferences.getFragmentForTest(); PreferenceScreen screen = fragment.getPreferenceScreen(); - String historySummary = - getCheckboxSummary(screen, ClearBrowsingDataPreferencesBasic.PREF_HISTORY); + String historySummary = getCheckboxSummary(screen, + ClearBrowsingDataPreferences.getPreferenceKey(DialogOption.CLEAR_HISTORY)); assertThat(historySummary, containsString(OTHER_ACTIVITY)); assertThat(historySummary, containsString(SIGNED_IN_DEVICES));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java index 28ee926..09c7d481 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java
@@ -17,6 +17,7 @@ import android.support.test.InstrumentationRegistry; import android.support.test.filters.LargeTest; import android.support.test.filters.MediumTest; +import android.support.v4.util.ArraySet; import android.support.v7.app.AlertDialog; import android.widget.Button; import android.widget.ListView; @@ -146,7 +147,8 @@ Assert.assertEquals(new HashSet<>(Arrays.asList("first")), WebappRegistry.getRegisteredWebappIdsForTesting()); - setDataTypesToClear(Arrays.asList(DialogOption.CLEAR_COOKIES_AND_SITE_DATA)); + setDataTypesToClear( + new ArraySet<>(Arrays.asList(DialogOption.CLEAR_COOKIES_AND_SITE_DATA))); final ClearBrowsingDataPreferences preferences = (ClearBrowsingDataPreferences) startPreferences().getFragmentForTest(); @@ -172,7 +174,7 @@ Assert.assertEquals(new HashSet<>(Arrays.asList("first")), WebappRegistry.getRegisteredWebappIdsForTesting()); - setDataTypesToClear(Arrays.asList(DialogOption.CLEAR_HISTORY)); + setDataTypesToClear(new ArraySet<>(Arrays.asList(DialogOption.CLEAR_HISTORY))); final ClearBrowsingDataPreferences preferences = (ClearBrowsingDataPreferences) startPreferences().getFragmentForTest(); @@ -196,7 +198,7 @@ @Test @MediumTest public void testClearingEverything() throws Exception { - setDataTypesToClear(Arrays.asList(DialogOption.values())); + setDataTypesToClear(ClearBrowsingDataPreferences.getAllOptions()); final ClearBrowsingDataPreferences preferences = (ClearBrowsingDataPreferences) startPreferences().getFragmentForTest(); @@ -287,7 +289,7 @@ // History is not selected. We still need to select some other datatype, otherwise the // "Clear" button won't be enabled. - setDataTypesToClear(Arrays.asList(DialogOption.CLEAR_CACHE)); + setDataTypesToClear(new ArraySet<>(Arrays.asList(DialogOption.CLEAR_CACHE))); final Preferences preferences1 = startPreferences(); ThreadUtils.runOnUiThreadBlocking( new OpenPreferencesEnableDialogAndClickClearRunnable(preferences1)); @@ -297,7 +299,7 @@ CriteriaHelper.pollUiThread(new PreferenceScreenClosedCriterion(preferences1)); // Reopen Clear Browsing Data preferences, this time with history selected for clearing. - setDataTypesToClear(Arrays.asList(DialogOption.CLEAR_HISTORY)); + setDataTypesToClear(new ArraySet<>(Arrays.asList(DialogOption.CLEAR_HISTORY))); final Preferences preferences2 = startPreferences(); ThreadUtils.runOnUiThreadBlocking( new OpenPreferencesEnableDialogAndClickClearRunnable(preferences2)); @@ -326,7 +328,7 @@ CriteriaHelper.pollUiThread(new PreferenceScreenClosedCriterion(preferences2)); // Reopen Clear Browsing Data preferences and clear history once again. - setDataTypesToClear(Arrays.asList(DialogOption.CLEAR_HISTORY)); + setDataTypesToClear(new ArraySet<>(Arrays.asList(DialogOption.CLEAR_HISTORY))); final Preferences preferences3 = startPreferences(); ThreadUtils.runOnUiThreadBlocking( new OpenPreferencesEnableDialogAndClickClearRunnable(preferences3)); @@ -554,7 +556,7 @@ assertThat(getUrls(controller), Matchers.contains(url1, url2)); // Clear history. - setDataTypesToClear(Arrays.asList(DialogOption.CLEAR_HISTORY)); + setDataTypesToClear(new ArraySet<>(Arrays.asList(DialogOption.CLEAR_HISTORY))); ClearBrowsingDataPreferences preferences = (ClearBrowsingDataPreferences) startPreferences().getFragmentForTest(); ThreadUtils.runOnUiThreadBlocking(() -> clickClearButton(preferences)); @@ -596,7 +598,7 @@ assertNull(frozen[0].getWebContents()); // Delete history. - setDataTypesToClear(Arrays.asList(DialogOption.CLEAR_HISTORY)); + setDataTypesToClear(new ArraySet<>(Arrays.asList(DialogOption.CLEAR_HISTORY))); ClearBrowsingDataPreferences preferences = (ClearBrowsingDataPreferences) startPreferences().getFragmentForTest(); ThreadUtils.runOnUiThreadBlocking(() -> clickClearButton(preferences)); @@ -622,12 +624,13 @@ } } - private void setDataTypesToClear(final List<DialogOption> typesToClear) { + private void setDataTypesToClear(final ArraySet<Integer> typesToClear) { ThreadUtils.runOnUiThreadBlocking(() -> { - for (DialogOption option : DialogOption.values()) { + for (@DialogOption Integer option : ClearBrowsingDataPreferences.getAllOptions()) { boolean enabled = typesToClear.contains(option); PrefServiceBridge.getInstance().setBrowsingDataDeletionPreference( - option.getDataType(), ClearBrowsingDataTab.ADVANCED, enabled); + ClearBrowsingDataPreferences.getDataType(option), + ClearBrowsingDataTab.ADVANCED, enabled); } }); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java index c7ada8d..d3e2dec 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java
@@ -20,6 +20,7 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.net.test.util.TestWebServer; @@ -162,7 +163,7 @@ ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override public void run() { - if (!visible) tab.hide(); + if (!visible) tab.hide(TabHidingType.CHANGED_TABS); tab.simulateRendererKilledForTesting(false); } });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ScrimTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ScrimTest.java index a451c701..8e86219 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ScrimTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ScrimTest.java
@@ -33,6 +33,7 @@ import org.chromium.chrome.browser.widget.ScrimView.ScrimParams; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController; +import org.chromium.chrome.browser.widget.bottomsheet.TestBottomSheetContent; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.OmniboxTestUtils; @@ -120,8 +121,11 @@ mActivityTestRule.getActivity().isViewObscuringAllTabs()); assertEquals("The scrim alpha should be 0.", 0f, mScrim.getAlpha(), MathUtils.EPSILON); - ThreadUtils.runOnUiThreadBlocking( - () -> mBottomSheet.setSheetState(BottomSheet.SheetState.HALF, false)); + ThreadUtils.runOnUiThreadBlocking(() -> { + mBottomSheet.showContent(new TestBottomSheetContent( + mActivityTestRule.getActivity(), BottomSheet.ContentPriority.HIGH)); + mBottomSheet.setSheetState(BottomSheet.SheetState.HALF, false); + }); assertScrimVisibility(true); assertTrue("A view should be obscuring the tab.",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserverTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserverTest.java index 711e219a..66d1758 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserverTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserverTest.java
@@ -13,6 +13,7 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.browser.util.MathUtils; @@ -32,7 +33,11 @@ @Before public void setUp() throws Exception { - mBottomSheetTestRule.startMainActivityOnBlankPage(); + mBottomSheetTestRule.startMainActivityOnBottomSheet(BottomSheet.SheetState.PEEK); + ThreadUtils.runOnUiThreadBlocking(() -> { + mBottomSheetTestRule.getBottomSheet().showContent(new TestBottomSheetContent( + mBottomSheetTestRule.getActivity(), BottomSheet.ContentPriority.HIGH)); + }); mObserver = mBottomSheetTestRule.getObserver(); } @@ -118,6 +123,7 @@ @Test @MediumTest public void testOffsetChangedEvent() throws InterruptedException, TimeoutException { + mBottomSheetTestRule.setSheetState(BottomSheet.SheetState.FULL, false); CallbackHelper callbackHelper = mObserver.mOffsetChangedCallbackHelper; BottomSheet bottomSheet = mBottomSheetTestRule.getBottomSheet(); @@ -152,6 +158,7 @@ @Test @MediumTest public void testPeekToHalfTransition() throws InterruptedException, TimeoutException { + mBottomSheetTestRule.setSheetState(BottomSheet.SheetState.FULL, false); CallbackHelper callbackHelper = mObserver.mPeekToHalfCallbackHelper; BottomSheet bottomSheet = mBottomSheetTestRule.getBottomSheet();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/TestBottomSheetContent.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/TestBottomSheetContent.java index 0450852..42443ef3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/TestBottomSheetContent.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/TestBottomSheetContent.java
@@ -12,11 +12,12 @@ import android.view.ViewGroup; import org.chromium.base.ThreadUtils; +import org.chromium.chrome.R; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetContent; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.ContentPriority; /** A simple sheet content to test with. This only displays two empty white views. */ -class TestBottomSheetContent implements BottomSheetContent { +public class TestBottomSheetContent implements BottomSheetContent { /** Empty view that represents the toolbar. */ private View mToolbarView; @@ -85,4 +86,24 @@ public boolean useSlimPeek() { return false; } + + @Override + public int getSheetContentDescriptionStringId() { + return R.string.contextual_suggestions_button_description; + } + + @Override + public int getSheetHalfHeightAccessibilityStringId() { + return R.string.contextual_suggestions_sheet_opened_half; + } + + @Override + public int getSheetFullHeightAccessibilityStringId() { + return R.string.contextual_suggestions_sheet_opened_full; + } + + @Override + public int getSheetClosedAccessibilityStringId() { + return R.string.contextual_suggestions_sheet_closed; + } }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingControllerTest.java index 6d30efd9..0057d9c 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingControllerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingControllerTest.java
@@ -48,6 +48,7 @@ import org.chromium.chrome.browser.modelutil.ListObservable; import org.chromium.chrome.browser.modelutil.PropertyModel; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; @@ -282,7 +283,7 @@ // Simulate closing the tab: mediator.getTabModelObserverForTesting().willCloseTab(tab, false); - mediator.getTabObserverForTesting().onHidden(tab); + mediator.getTabObserverForTesting().onHidden(tab, TabHidingType.CHANGED_TABS); // Temporary removes the tab, but keeps it in memory so it can be brought back on undo: assertThat(keyboardAccessoryModel.get(TABS).size(), is(0)); @@ -484,13 +485,13 @@ int lastId = INVALID_TAB_ID; if (lastTab != null) { lastId = lastTab.getId(); - mediator.getTabObserverForTesting().onHidden(lastTab); + mediator.getTabObserverForTesting().onHidden(lastTab, TabHidingType.CHANGED_TABS); } Tab tab = mock(Tab.class); when(tab.getId()).thenReturn(id); when(mMockTabModelSelector.getCurrentTab()).thenReturn(tab); mediator.getTabModelObserverForTesting().didAddTab(tab, FROM_BROWSER_ACTIONS); - mediator.getTabObserverForTesting().onShown(tab); + mediator.getTabObserverForTesting().onShown(tab, FROM_NEW); mediator.getTabModelObserverForTesting().didSelectTab(tab, FROM_NEW, lastId); return tab; } @@ -505,11 +506,11 @@ int lastId = INVALID_TAB_ID; if (from != null) { lastId = from.getId(); - mediator.getTabObserverForTesting().onHidden(from); + mediator.getTabObserverForTesting().onHidden(from, TabHidingType.CHANGED_TABS); } when(mMockTabModelSelector.getCurrentTab()).thenReturn(to); mediator.getTabModelObserverForTesting().didSelectTab(to, FROM_USER, lastId); - mediator.getTabObserverForTesting().onShown(to); + mediator.getTabObserverForTesting().onShown(to, FROM_USER); } /** @@ -520,7 +521,7 @@ */ private void closeTab(ManualFillingMediator mediator, Tab tabToBeClosed, @Nullable Tab next) { mediator.getTabModelObserverForTesting().willCloseTab(tabToBeClosed, false); - mediator.getTabObserverForTesting().onHidden(tabToBeClosed); + mediator.getTabObserverForTesting().onHidden(tabToBeClosed, TabHidingType.CHANGED_TABS); if (next != null) { when(mMockTabModelSelector.getCurrentTab()).thenReturn(next); mediator.getTabModelObserverForTesting().didSelectTab(
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/contextual_suggestions/PageViewTimerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/contextual_suggestions/PageViewTimerTest.java index 771da6ef..72ac00a 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/contextual_suggestions/PageViewTimerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/contextual_suggestions/PageViewTimerTest.java
@@ -27,6 +27,7 @@ import org.chromium.chrome.browser.contextual_suggestions.PageViewTimer.DurationBucket; import org.chromium.chrome.browser.contextual_suggestions.PageViewTimer.NavigationSource; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; @@ -356,11 +357,11 @@ } private Runnable pauseTimerByHidingTab(Tab tab) { - return () -> getTabObserver().onHidden(tab); + return () -> getTabObserver().onHidden(tab, TabHidingType.CHANGED_TABS); } private Runnable resumeTimerByShowingTab(Tab tab) { - return () -> getTabObserver().onShown(tab); + return () -> getTabObserver().onShown(tab, TabSelectionType.FROM_USER); } private void selectTab_showContent_pauseTimer_resumeTimer_stopTimer(
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutControllerTest.java index 0a9e96f..707b3e1 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutControllerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutControllerTest.java
@@ -27,6 +27,7 @@ import org.chromium.chrome.browser.InsetObserverView; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.testing.local.LocalRobolectricTestRunner; /** @@ -185,7 +186,7 @@ verify(mTab).addObserver(mTabObserverCaptor.capture()); reset(mTab); - mTabObserverCaptor.getValue().onShown(mTab); + mTabObserverCaptor.getValue().onShown(mTab, TabSelectionType.FROM_NEW); verify(mTab).getActivity(); } }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/StreamLifecycleManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/StreamLifecycleManagerTest.java index 39b4343..a3bfe742 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/StreamLifecycleManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/StreamLifecycleManagerTest.java
@@ -11,6 +11,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.chromium.chrome.browser.tab.Tab.TabHidingType.CHANGED_TABS; +import static org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType.FROM_NEW; +import static org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType.FROM_USER; + import android.app.Activity; import android.support.test.filters.SmallTest; @@ -29,6 +33,7 @@ import org.chromium.base.ApplicationStatus; import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; /** * Unit tests for {@link StreamLifecycleManager}. @@ -59,7 +64,7 @@ // Verify that onShow is not called before activity started. when(mTab.isHidden()).thenReturn(false); when(mTab.isUserInteractable()).thenReturn(true); - mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab); + mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab, FROM_NEW); verify(mStream, times(0)).onShow(); // Verify that onShow is not called when Tab is hidden. @@ -69,11 +74,11 @@ // Verify that onShow is called when Tab is shown and activity is started. when(mTab.isHidden()).thenReturn(false); - mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab); + mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab, FROM_NEW); verify(mStream, times(1)).onShow(); // When the Stream is shown, it won't call Stream#onShow() again. - mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab); + mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab, FROM_NEW); verify(mStream, times(1)).onShow(); } @@ -209,7 +214,8 @@ verify(mStream, times(1)).onShow(); // Verify that onActive and onInactive are skipped when Stream is set hidden from shown. - mStreamLifecycleManager.getTabObserverForTesting().onHidden(mTab); + mStreamLifecycleManager.getTabObserverForTesting().onHidden( + mTab, TabHidingType.CHANGED_TABS); verify(mStream, times(1)).onShow(); verify(mStream, times(0)).onActive(); verify(mStream, times(0)).onInactive(); @@ -334,7 +340,7 @@ // On tab shown. when(mTab.isHidden()).thenReturn(false); - mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab); + mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab, FROM_NEW); inOrder.verify(mStream).onShow(); verify(mStream, times(1)).onShow(); @@ -360,7 +366,7 @@ when(mTab.isHidden()).thenReturn(true); when(mTab.isUserInteractable()).thenReturn(false); mStreamLifecycleManager.getTabObserverForTesting().onInteractabilityChanged(false); - mStreamLifecycleManager.getTabObserverForTesting().onHidden(mTab); + mStreamLifecycleManager.getTabObserverForTesting().onHidden(mTab, CHANGED_TABS); inOrder.verify(mStream).onInactive(); inOrder.verify(mStream).onHide(); verify(mStream, times(2)).onInactive(); @@ -368,7 +374,7 @@ // On tab shown (simulates user switch back to this tab). when(mTab.isHidden()).thenReturn(false); - mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab); + mStreamLifecycleManager.getTabObserverForTesting().onShown(mTab, FROM_USER); inOrder.verify(mStream).onShow(); verify(mStream, times(2)).onShow();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserverTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserverTest.java index 6378a76..2c89702f 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserverTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserverTest.java
@@ -15,6 +15,8 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType.FROM_NEW; + import android.content.Context; import org.junit.Before; @@ -31,6 +33,8 @@ import org.chromium.chrome.browser.snackbar.SnackbarManager; import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarController; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelSelector; /** @@ -93,14 +97,14 @@ private void showTab(OfflinePageTabObserver observer) { doReturn(false).when(mTab).isHidden(); if (observer != null) { - observer.onShown(mTab); + observer.onShown(mTab, FROM_NEW); } } private void hideTab(OfflinePageTabObserver observer) { doReturn(true).when(mTab).isHidden(); if (observer != null) { - observer.onHidden(mTab); + observer.onHidden(mTab, TabHidingType.CHANGED_TABS); } } @@ -298,7 +302,7 @@ observer.startObservingTab(mTab); observer.onPageLoadFinished(mTab); - observer.onShown(mTab); + observer.onShown(mTab, FROM_NEW); verify(observer, times(0)).showReloadSnackbar(any(Tab.class)); } @@ -312,7 +316,7 @@ observer.startObservingTab(mTab); - observer.onShown(mTab); + observer.onShown(mTab, FROM_NEW); verify(observer, times(0)).showReloadSnackbar(any(Tab.class)); } @@ -592,7 +596,7 @@ verify(observer, times(1)).showReloadSnackbar(any(Tab.class)); // Event ignored, snackbar not shown again. - observer.onShown(mTab); + observer.onShown(mTab, TabSelectionType.FROM_NEW); verify(observer, times(1)).showReloadSnackbar(any(Tab.class)); // Event triggers snackbar again.
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index be11b6d..da74584 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -1432,6 +1432,9 @@ <message name="IDS_SETTINGS_DOWNLOADS_SHARE_ADDED_MOUNT_EXISTS_MESSAGE" desc="The message shown when mounting a new SMB share fails because the share is already mounted."> Error mounting share. The specified share is already mounted. </message> + <message name="IDS_SETTINGS_DOWNLOADS_SHARE_ADDED_MOUNT_INVALID_URL_MESSAGE" desc="The message shown when mounting a new SMB share fails because the URL is an invalid format."> + Invalid URL format. Supported formats are \\server\share and smb://server/share. + </message> <!-- Date/Time Page --> <message name="IDS_SETTINGS_DATE_TIME" desc="Name of the settings page which displays date and time preferences.">
diff --git a/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc b/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc index 9708b8c..484bef4 100644 --- a/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc +++ b/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc
@@ -42,7 +42,6 @@ const JavaParamRef<jobject>& jobj, const JavaParamRef<jobject>& jtab_content_manager, jint id, - jint toolbar_resource_id, jboolean can_use_live_layer, jint default_background_color, jfloat x,
diff --git a/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.h b/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.h index 00bec18..21e610c 100644 --- a/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.h +++ b/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.h
@@ -38,7 +38,6 @@ const base::android::JavaParamRef<jobject>& jobj, const base::android::JavaParamRef<jobject>& jtab_content_manager, jint id, - jint toolbar_resource_id, jboolean can_use_live_layer, jint default_background_color, jfloat x,
diff --git a/chrome/browser/apps/platform_apps/platform_app_launch.cc b/chrome/browser/apps/platform_apps/platform_app_launch.cc index 91c6020..2fc86ba 100644 --- a/chrome/browser/apps/platform_apps/platform_app_launch.cc +++ b/chrome/browser/apps/platform_apps/platform_app_launch.cc
@@ -9,6 +9,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/extensions/app_launch_params.h" #include "chrome/browser/ui/extensions/application_launch.h" +#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_metrics.h" #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_prefs.h" @@ -148,4 +149,16 @@ return app_tab != nullptr; } +void RecordExtensionAppLaunchOnTabRestored(Profile* profile, const GURL& url) { + const extensions::Extension* extension = + extensions::ExtensionRegistry::Get(profile) + ->enabled_extensions() + .GetAppByURL(url); + if (!extension) + return; + + extensions::RecordAppLaunchType( + extension_misc::APP_LAUNCH_NTP_RECENTLY_CLOSED, extension->GetType()); +} + } // namespace apps
diff --git a/chrome/browser/apps/platform_apps/platform_app_launch.h b/chrome/browser/apps/platform_apps/platform_app_launch.h index c2c2922..c816f35 100644 --- a/chrome/browser/apps/platform_apps/platform_app_launch.h +++ b/chrome/browser/apps/platform_apps/platform_app_launch.h
@@ -44,6 +44,9 @@ // otherwise. bool OpenExtensionAppShortcutWindow(Profile* profile, const GURL& url); +// Records the restored app launch for UMA. +void RecordExtensionAppLaunchOnTabRestored(Profile* profile, const GURL& url); + } // namespace apps #endif // CHROME_BROWSER_APPS_PLATFORM_APPS_PLATFORM_APP_LAUNCH_H_
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 19d875b..58e8c1e 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -434,8 +434,6 @@ #include "chrome/browser/extensions/bookmark_app_navigation_throttle.h" #include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h" #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" -#include "chrome/browser/extensions/user_script_listener.h" -#include "chrome/browser/media/cast_transport_host_filter.h" #include "chrome/browser/speech/extension_api/tts_engine_delegate_factory_impl.h" #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" #include "chrome/browser/ui/extensions/hosted_app_browser_controller.h" @@ -463,6 +461,10 @@ #include "extensions/common/permissions/permissions_data.h" #include "extensions/common/permissions/socket_permission.h" #include "extensions/common/switches.h" +#endif + +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "chrome/browser/media/cast_transport_host_filter.h" #endif // BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_MUS) @@ -4039,13 +4041,6 @@ #if BUILDFLAG(ENABLE_EXTENSIONS) throttles.push_back( std::make_unique<extensions::ExtensionNavigationThrottle>(handle)); - - std::unique_ptr<content::NavigationThrottle> user_script_throttle = - extensions::ExtensionsBrowserClient::Get() - ->GetUserScriptListener() - ->CreateNavigationThrottle(handle); - if (user_script_throttle) - throttles.push_back(std::move(user_script_throttle)); #endif #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 17b4452..01f06994 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -2091,6 +2091,7 @@ "extensions/file_manager/drivefs_event_router_unittest.cc", "extensions/file_manager/job_event_router_unittest.cc", "extensions/gfx_utils_unittest.cc", + "extensions/install_limiter_unittest.cc", "extensions/permissions_updater_delegate_chromeos_unittest.cc", "extensions/public_session_permission_helper_unittest.cc", "extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc",
diff --git a/chrome/browser/chromeos/arc/arc_support_host.cc b/chrome/browser/chromeos/arc/arc_support_host.cc index 03a2f16..12f70ea 100644 --- a/chrome/browser/chromeos/arc/arc_support_host.cc +++ b/chrome/browser/chromeos/arc/arc_support_host.cc
@@ -567,10 +567,6 @@ return true; } -void ArcSupportHost::OnDisplayAdded(const display::Display& new_display) {} - -void ArcSupportHost::OnDisplayRemoved(const display::Display& old_display) {} - void ArcSupportHost::OnDisplayMetricsChanged(const display::Display& display, uint32_t changed_metrics) { if (!message_host_)
diff --git a/chrome/browser/chromeos/arc/arc_support_host.h b/chrome/browser/chromeos/arc/arc_support_host.h index 3994dbcc..ccf69f31 100644 --- a/chrome/browser/chromeos/arc/arc_support_host.h +++ b/chrome/browser/chromeos/arc/arc_support_host.h
@@ -157,8 +157,6 @@ void OnMessage(const base::DictionaryValue& message) override; // display::DisplayObserver: - void OnDisplayAdded(const display::Display& new_display) override; - void OnDisplayRemoved(const display::Display& old_display) override; void OnDisplayMetricsChanged(const display::Display& display, uint32_t changed_metrics) override;
diff --git a/chrome/browser/chromeos/child_accounts/screen_time_controller.cc b/chrome/browser/chromeos/child_accounts/screen_time_controller.cc index 2d38ad6..09298bd9 100644 --- a/chrome/browser/chromeos/child_accounts/screen_time_controller.cc +++ b/chrome/browser/chromeos/child_accounts/screen_time_controller.cc
@@ -102,15 +102,11 @@ const icu::TimeZone& time_zone = system::TimezoneSettings::GetInstance()->GetTimezone(); base::Optional<usage_time_limit::State> last_state = GetLastStateFromPref(); - // Used time should be 0 when time usage limit is disabled. - base::TimeDelta used_time = base::TimeDelta::FromMinutes(0); - if (last_state && last_state->is_time_usage_limit_enabled) - used_time = GetScreenTimeDuration(); const base::DictionaryValue* time_limit = pref_service_->GetDictionary(prefs::kUsageTimeLimit); usage_time_limit::State state = usage_time_limit::GetState( - time_limit->CreateDeepCopy(), used_time, first_screen_start_time_, now, - &time_zone, last_state); + time_limit->CreateDeepCopy(), GetScreenTimeDuration(), + first_screen_start_time_, now, &time_zone, last_state); SaveCurrentStateToPref(state); // Show/hide time limits message based on the policy enforcement. @@ -155,13 +151,6 @@ notification_type.value(), kExitNotificationTimeout)); } } - - // The screen limit should start counting only when the time usage limit is - // set, ignoring the amount of time that the device was used before. - if (state.is_time_usage_limit_enabled && - (!last_state || !last_state->is_time_usage_limit_enabled)) { - RefreshScreenLimit(); - } } if (!state.next_state_change_time.is_null()) {
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index b71fa2b0..30cb42a 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -678,7 +678,10 @@ CHECK(base::PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); - DeviceOAuth2TokenServiceFactory::Initialize(); + DeviceOAuth2TokenServiceFactory::Initialize( + g_browser_process->system_network_context_manager() + ->GetSharedURLLoaderFactory(), + g_browser_process->local_state()); wake_on_wifi_manager_.reset(new WakeOnWifiManager()); network_throttling_observer_.reset(
diff --git a/chrome/browser/chromeos/chrome_content_browser_client_chromeos_part.cc b/chrome/browser/chromeos/chrome_content_browser_client_chromeos_part.cc index ca0674c..22747bd98 100644 --- a/chrome/browser/chromeos/chrome_content_browser_client_chromeos_part.cc +++ b/chrome/browser/chromeos/chrome_content_browser_client_chromeos_part.cc
@@ -62,6 +62,12 @@ // apps. content::WebContents* contents = content::WebContents::FromRenderViewHost(rvh); + + // A webcontents may not be the delegate of the render view host such as in + // the case of interstitial pages. + if (!contents) + return; + auto* browser = chrome::FindBrowserWithWebContents(contents); if (!browser || browser->is_app()) return;
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc index a951bd17b..e27c3623 100644 --- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc +++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
@@ -919,14 +919,10 @@ file_definition.is_directory = true; file_manager::util::ConvertFileDefinitionToEntryDefinition( - profile_, - *extension_id, - file_definition, - base::Bind( + profile_, *extension_id, file_definition, + base::BindOnce( &EventRouter::DispatchDirectoryChangeEventWithEntryDefinition, - weak_factory_.GetWeakPtr(), - changes, - base::Owned(extension_id), + weak_factory_.GetWeakPtr(), changes, base::Owned(extension_id), got_error)); } }
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc index bd53249..5c1c757 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc
@@ -342,10 +342,8 @@ render_frame_host()->GetProcess()->GetID(), full_path); file_manager::util::ConvertFileDefinitionToEntryDefinition( - GetProfile(), - extension_id(), - file_definition, - base::Bind( + GetProfile(), extension_id(), file_definition, + base::BindOnce( &FileBrowserHandlerInternalSelectFileFunction::RespondEntryDefinition, this)); }
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc index 5d39719..b9da91c 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
@@ -229,7 +229,7 @@ Profile* profile, const std::string& extension_id, const std::vector<T>& search_result_info_list, - const EntryDefinitionListCallback& callback) { + EntryDefinitionListCallback callback) { FileDefinitionList file_definition_list; for (size_t i = 0; i < search_result_info_list.size(); ++i) { @@ -242,10 +242,9 @@ } file_manager::util::ConvertFileDefinitionListToEntryDefinitionList( - profile, - extension_id, + profile, extension_id, file_definition_list, // Safe, since copied internally. - callback); + std::move(callback)); } class SingleEntryPropertiesGetterForDrive { @@ -1037,13 +1036,10 @@ const SearchResultInfoList& results_ref = *results.get(); ConvertSearchResultInfoListToEntryDefinitionList( - GetProfile(), - extension_->id(), - results_ref, - base::Bind(&FileManagerPrivateSearchDriveFunction::OnEntryDefinitionList, - this, - next_link, - base::Passed(&results))); + GetProfile(), extension_->id(), results_ref, + base::BindOnce( + &FileManagerPrivateSearchDriveFunction::OnEntryDefinitionList, this, + next_link, std::move(results))); } void FileManagerPrivateSearchDriveFunction::OnEntryDefinitionList( @@ -1126,13 +1122,10 @@ const drive::MetadataSearchResultVector& results_ref = *results.get(); ConvertSearchResultInfoListToEntryDefinitionList( - GetProfile(), - extension_->id(), - results_ref, - base::Bind( + GetProfile(), extension_->id(), results_ref, + base::BindOnce( &FileManagerPrivateSearchDriveMetadataFunction::OnEntryDefinitionList, - this, - base::Passed(&results))); + this, std::move(results))); } void FileManagerPrivateSearchDriveMetadataFunction::OnEntryDefinitionList(
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc index 0b93688..72d22fe 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
@@ -841,10 +841,9 @@ } file_manager::util::ConvertFileDefinitionListToEntryDefinitionList( - GetProfile(), - extension_->id(), + GetProfile(), extension_->id(), file_definition_list, // Safe, since copied internally. - base::Bind( + base::BindOnce( &FileManagerPrivateInternalResolveIsolatedEntriesFunction:: RunAsyncAfterConvertFileDefinitionListToEntryDefinitionList, this)); @@ -1064,9 +1063,17 @@ const std::unique_ptr<Params> params(Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params); - const base::FilePath local_path = file_manager::util::GetLocalPathFromURL( - render_frame_host(), chrome_details_.GetProfile(), GURL(params->url)); - const base::FilePath drive_path = drive::util::ExtractDrivePath(local_path); + scoped_refptr<storage::FileSystemContext> file_system_context = + file_manager::util::GetFileSystemContextForRenderFrameHost( + Profile::FromBrowserContext(browser_context()), render_frame_host()); + const storage::FileSystemURL file_system_url( + file_system_context->CrackURL(GURL(params->url))); + if (file_system_url.type() == storage::kFileSystemTypeDriveFs) { + return RespondNow(NoArguments()); + } + + const base::FilePath drive_path = + drive::util::ExtractDrivePath(file_system_url.path()); if (drive_path.empty()) return RespondNow(Error("Only Drive files and directories are supported."));
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc index 5ba7112..c4cdabe 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc
@@ -960,9 +960,9 @@ file_manager::util::ConvertFileDefinitionListToEntryDefinitionList( chrome_details_.GetProfile(), extension_id(), file_definition_list, // Safe, since copied internally. - base::Bind(&FileManagerPrivateInternalGetRecentFilesFunction:: - OnConvertFileDefinitionListToEntryDefinitionList, - this)); + base::BindOnce(&FileManagerPrivateInternalGetRecentFilesFunction:: + OnConvertFileDefinitionListToEntryDefinitionList, + this)); } void FileManagerPrivateInternalGetRecentFilesFunction::
diff --git a/chrome/browser/chromeos/extensions/install_limiter.cc b/chrome/browser/chromeos/extensions/install_limiter.cc index 7db15a7..58b661a8 100644 --- a/chrome/browser/chromeos/extensions/install_limiter.cc +++ b/chrome/browser/chromeos/extensions/install_limiter.cc
@@ -10,6 +10,7 @@ #include "base/files/file_util.h" #include "base/task/post_task.h" #include "chrome/browser/chromeos/extensions/install_limiter_factory.h" +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "extensions/browser/notification_types.h" @@ -46,10 +47,19 @@ //////////////////////////////////////////////////////////////////////////////// // InstallLimiter +// static InstallLimiter* InstallLimiter::Get(Profile* profile) { return InstallLimiterFactory::GetForProfile(profile); } +// static +bool InstallLimiter::ShouldDeferInstall(int64_t app_size, + const std::string& app_id) { + constexpr int64_t kBigAppSizeThreshold = 1048576; // 1MB in bytes + return app_size > kBigAppSizeThreshold && + !chromeos::DemoSession::IsScreensaverInDemoMode(app_id); +} + InstallLimiter::InstallLimiter() : disabled_for_test_(false) { } @@ -76,9 +86,7 @@ void InstallLimiter::AddWithSize(const scoped_refptr<CrxInstaller>& installer, const base::FilePath& path, int64_t size) { - const int64_t kBigAppSizeThreshold = 1048576; // 1MB - - if (size <= kBigAppSizeThreshold) { + if (!ShouldDeferInstall(size, installer->expected_id())) { RunInstall(installer, path); // Stop wait timer and let install notification drive deferred installs.
diff --git a/chrome/browser/chromeos/extensions/install_limiter.h b/chrome/browser/chromeos/extensions/install_limiter.h index 4de8c30a..04128ca 100644 --- a/chrome/browser/chromeos/extensions/install_limiter.h +++ b/chrome/browser/chromeos/extensions/install_limiter.h
@@ -32,6 +32,11 @@ public: static InstallLimiter* Get(Profile* profile); + // Install should be deferred if the size is larger than 1MB and the app is + // not the screensaver in demo mode (which requires instant installation to + // avoid visual delay). + static bool ShouldDeferInstall(int64_t app_size, const std::string& app_id); + InstallLimiter(); ~InstallLimiter() override;
diff --git a/chrome/browser/chromeos/extensions/install_limiter_unittest.cc b/chrome/browser/chromeos/extensions/install_limiter_unittest.cc new file mode 100644 index 0000000..103c15a6 --- /dev/null +++ b/chrome/browser/chromeos/extensions/install_limiter_unittest.cc
@@ -0,0 +1,68 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/extensions/install_limiter.h" + +#include "base/macros.h" +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" +#include "chrome/browser/chromeos/settings/stub_install_attributes.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "extensions/common/constants.h" +#include "testing/gtest/include/gtest/gtest.h" + +using extensions::InstallLimiter; + +namespace { + +constexpr char kRandomExtensionId[] = "abacabadabacabaeabacabadabacabaf"; +constexpr int kLargeExtensionSize = 2000000; +constexpr int kSmallExtensionSize = 200000; + +} // namespace + +class InstallLimiterTest : public testing::Test { + public: + InstallLimiterTest() = default; + ~InstallLimiterTest() override = default; + + private: + content::TestBrowserThreadBundle thread_bundle_; + chromeos::ScopedStubInstallAttributes test_install_attributes_; + + DISALLOW_COPY_AND_ASSIGN(InstallLimiterTest); +}; + +TEST_F(InstallLimiterTest, ShouldDeferInstall) { + // In non-demo mode, all apps larger than 1 MB should be deferred. + chromeos::DemoSession::SetDemoConfigForTesting( + chromeos::DemoSession::DemoModeConfig::kNone); + EXPECT_TRUE(InstallLimiter::ShouldDeferInstall( + kLargeExtensionSize, extension_misc::kScreensaverAppId)); + EXPECT_TRUE(InstallLimiter::ShouldDeferInstall(kLargeExtensionSize, + kRandomExtensionId)); + EXPECT_FALSE(InstallLimiter::ShouldDeferInstall(kSmallExtensionSize, + kRandomExtensionId)); + + // In demo mode (either online or offline), all apps larger than 1MB except + // for the screensaver should be deferred. + chromeos::DemoSession::SetDemoConfigForTesting( + chromeos::DemoSession::DemoModeConfig::kOnline); + EXPECT_FALSE(InstallLimiter::ShouldDeferInstall( + kLargeExtensionSize, extension_misc::kScreensaverAppId)); + EXPECT_TRUE(InstallLimiter::ShouldDeferInstall(kLargeExtensionSize, + kRandomExtensionId)); + EXPECT_FALSE(InstallLimiter::ShouldDeferInstall(kSmallExtensionSize, + kRandomExtensionId)); + + chromeos::DemoSession::SetDemoConfigForTesting( + chromeos::DemoSession::DemoModeConfig::kOffline); + EXPECT_FALSE(InstallLimiter::ShouldDeferInstall( + kLargeExtensionSize, extension_misc::kScreensaverAppId)); + EXPECT_TRUE(InstallLimiter::ShouldDeferInstall(kLargeExtensionSize, + kRandomExtensionId)); + EXPECT_FALSE(InstallLimiter::ShouldDeferInstall(kSmallExtensionSize, + kRandomExtensionId)); + + chromeos::DemoSession::ResetDemoConfigForTesting(); +} \ No newline at end of file
diff --git a/chrome/browser/chromeos/file_manager/crostini_file_tasks.cc b/chrome/browser/chromeos/file_manager/crostini_file_tasks.cc index 8c939b9..c158170 100644 --- a/chrome/browser/chromeos/file_manager/crostini_file_tasks.cc +++ b/chrome/browser/chromeos/file_manager/crostini_file_tasks.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/chromeos/file_manager/crostini_file_tasks.h" #include <memory> +#include <set> #include <string> #include <utility> #include <vector> @@ -147,7 +148,7 @@ Profile* profile, const TaskDescriptor& task, const std::vector<storage::FileSystemURL>& file_system_urls, - const FileTaskFinishedCallback& done) { + FileTaskFinishedCallback done) { DCHECK(IsCrostiniUIAllowedForProfile(profile)); std::vector<std::string> files;
diff --git a/chrome/browser/chromeos/file_manager/crostini_file_tasks.h b/chrome/browser/chromeos/file_manager/crostini_file_tasks.h index d590d259..aa1eca6 100644 --- a/chrome/browser/chromeos/file_manager/crostini_file_tasks.h +++ b/chrome/browser/chromeos/file_manager/crostini_file_tasks.h
@@ -39,7 +39,7 @@ Profile* profile, const TaskDescriptor& task, const std::vector<storage::FileSystemURL>& file_system_urls, - const FileTaskFinishedCallback& done); + FileTaskFinishedCallback done); } // namespace file_tasks } // namespace file_manager
diff --git a/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.cc b/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.cc index 77c1784..20eb47a0 100644 --- a/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.cc +++ b/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" +#include <utility> + #include "chromeos/disks/disk.h" namespace file_manager {
diff --git a/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h b/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h index ce07e52..a052208 100644 --- a/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h +++ b/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ +#include <memory> #include <string> #include <vector>
diff --git a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc index 24ec1e79d..2d1d863 100644 --- a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc +++ b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
@@ -307,12 +307,10 @@ const FileDefinitionList& file_definition_list_ref = *file_definition_list.get(); file_manager::util::ConvertFileDefinitionListToEntryDefinitionList( - profile_, - extension_->id(), - file_definition_list_ref, - base::Bind(&FileBrowserHandlerExecutor::ExecuteFileActionsOnUIThread, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(&file_definition_list))); + profile_, extension_->id(), file_definition_list_ref, + base::BindOnce(&FileBrowserHandlerExecutor::ExecuteFileActionsOnUIThread, + weak_ptr_factory_.GetWeakPtr(), + std::move(file_definition_list))); } void FileBrowserHandlerExecutor::ExecuteDoneOnUIThread(bool success) {
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 69f7393..4c1cde6 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -367,6 +367,7 @@ TestCase("dirPasteWithoutChangingCurrent"), TestCase("dirRenameWithContextMenu"), TestCase("dirRenameWithContextMenu").InGuestMode(), + TestCase("dirRenameUpdateChildrenBreadcrumbs"), TestCase("dirRenameWithKeyboard"), TestCase("dirRenameWithKeyboard").InGuestMode(), TestCase("dirRenameWithoutChangingCurrent"), @@ -388,7 +389,9 @@ TestCase("drivePinFileMobileNetwork").EnableDriveFs(), TestCase("driveClickFirstSearchResult"), TestCase("drivePressEnterToSearch"), - TestCase("drivePressCtrlAFromSearch"))); + TestCase("drivePressCtrlAFromSearch"), + TestCase("driveBackupPhotos"), + TestCase("driveBackupPhotos").EnableDriveFs())); WRAPPED_INSTANTIATE_TEST_CASE_P( Transfer, /* transfer.js */
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc index 6994153e..72cec2f 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
@@ -32,6 +32,8 @@ #include "chrome/browser/chromeos/file_manager/volume_manager.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/notifications/notification_display_service_tester.h" +#include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" +#include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_features.h" #include "chrome/common/chrome_paths.h" @@ -571,6 +573,30 @@ return true; } + bool PrepareDcimTestEntries(Profile* profile) { + if (!CreateRootDirectory(profile)) + return false; + + CreateEntry(AddEntriesMessage::TestEntryInfo( + AddEntriesMessage::DIRECTORY, "", "DCIM", std::string(), "", + AddEntriesMessage::SharedOption::NONE, base::Time::Now(), + AddEntriesMessage::EntryCapabilities(), false)); + CreateEntry(AddEntriesMessage::TestEntryInfo( + AddEntriesMessage::FILE, "image2.png", "image2.png", std::string(), + "image/png", AddEntriesMessage::SharedOption::NONE, base::Time::Now(), + AddEntriesMessage::EntryCapabilities(), false)); + CreateEntry(AddEntriesMessage::TestEntryInfo( + AddEntriesMessage::FILE, "image3.jpg", "DCIM/image3.jpg", std::string(), + "image/jpeg", AddEntriesMessage::SharedOption::NONE, base::Time::Now(), + AddEntriesMessage::EntryCapabilities(), false)); + CreateEntry(AddEntriesMessage::TestEntryInfo( + AddEntriesMessage::FILE, "text.txt", "DCIM/hello.txt", std::string(), + "text/plain", AddEntriesMessage::SharedOption::NONE, base::Time::Now(), + AddEntriesMessage::EntryCapabilities(), false)); + base::RunLoop().RunUntilIdle(); + return true; + } + bool Mount(Profile* profile) override { if (!CreateRootDirectory(profile)) return false; @@ -1031,6 +1057,14 @@ } void FileManagerBrowserTestBase::SetUpOnMainThread() { + // Must happen after the browser process is created because instantiating + // the factory will instantiate ExtensionSystemFactory which depends on + // ExtensionsBrowserClient setup in BrowserProcessImpl. + sync_file_system::SyncFileSystemServiceFactory::GetInstance() + ->set_mock_remote_file_service( + std::make_unique<::testing::NiceMock< + sync_file_system::MockRemoteFileSyncService>>()); + extensions::ExtensionApiTest::SetUpOnMainThread(); CHECK(profile()); CHECK_EQ(!!browser(), GetRequiresStartupBrowser()); @@ -1266,13 +1300,16 @@ return; } - if (name == "mountFakeUsb" || name == "mountFakeUsbEmpty") { + if (name == "mountFakeUsb" || name == "mountFakeUsbEmpty" || + name == "mountFakeUsbDcim") { usb_volume_ = std::make_unique<FakeTestVolume>( "fake-usb", VOLUME_TYPE_REMOVABLE_DISK_PARTITION, chromeos::DEVICE_TYPE_USB); if (name == "mountFakeUsb") ASSERT_TRUE(usb_volume_->PrepareTestEntries(profile())); + else if (name == "mountFakeUsbDcim") + ASSERT_TRUE(usb_volume_->PrepareDcimTestEntries(profile())); ASSERT_TRUE(usb_volume_->Mount(profile())); return;
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h index e7cec05..3ad34f1b 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h
@@ -8,6 +8,7 @@ #include <map> #include <memory> #include <string> +#include <vector> #include "base/test/scoped_feature_list.h" #include "base/values.h"
diff --git a/chrome/browser/chromeos/file_manager/file_manager_jstest_base.h b/chrome/browser/chromeos/file_manager/file_manager_jstest_base.h index 80faa2c86..979b23c 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_jstest_base.h +++ b/chrome/browser/chromeos/file_manager/file_manager_jstest_base.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_JSTEST_BASE_H_ #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_JSTEST_BASE_H_ +#include <string> + #include "base/files/file_path.h" #include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/chromeos/file_manager/file_manager_uitest.cc b/chrome/browser/chromeos/file_manager/file_manager_uitest.cc index 683f67b..bfec5f1 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_uitest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_uitest.cc
@@ -53,7 +53,7 @@ EXPECT_TRUE(message_queue.WaitForMessage(&message)); } while (message == "\"PENDING\""); - EXPECT_TRUE(message == "\"SUCCESS\""); + EXPECT_EQ(message, "\"SUCCESS\""); } };
diff --git a/chrome/browser/chromeos/file_manager/file_tasks.cc b/chrome/browser/chromeos/file_manager/file_tasks.cc index 4baf87d..584b71c 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include <map> +#include <utility> #include "apps/launcher.h" #include "base/bind.h"
diff --git a/chrome/browser/chromeos/file_manager/file_watcher.cc b/chrome/browser/chromeos/file_manager/file_watcher.cc index 896ada265..02ada646 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher.cc +++ b/chrome/browser/chromeos/file_manager/file_watcher.cc
@@ -4,6 +4,9 @@ #include "chrome/browser/chromeos/file_manager/file_watcher.h" +#include <memory> +#include <utility> + #include "base/bind.h" #include "base/task/post_task.h" #include "base/task_runner_util.h" @@ -82,31 +85,30 @@ void FileWatcher::WatchLocalFile( const base::FilePath& local_path, const base::FilePathWatcher::Callback& file_watcher_callback, - const BoolCallback& callback) { + BoolCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!callback.is_null()); DCHECK(!local_file_watcher_); base::PostTaskAndReplyWithResult( sequenced_task_runner_.get(), FROM_HERE, - base::Bind(&CreateAndStartFilePathWatcher, local_path, - google_apis::CreateRelayCallback(file_watcher_callback)), - base::Bind(&FileWatcher::OnWatcherStarted, weak_ptr_factory_.GetWeakPtr(), - callback)); + base::BindOnce(&CreateAndStartFilePathWatcher, local_path, + google_apis::CreateRelayCallback(file_watcher_callback)), + base::BindOnce(&FileWatcher::OnWatcherStarted, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } -void FileWatcher::OnWatcherStarted( - const BoolCallback& callback, - base::FilePathWatcher* file_watcher) { +void FileWatcher::OnWatcherStarted(BoolCallback callback, + base::FilePathWatcher* file_watcher) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!callback.is_null()); DCHECK(!local_file_watcher_); if (file_watcher) { local_file_watcher_ = file_watcher; - callback.Run(true); + std::move(callback).Run(true); } else { - callback.Run(false); + std::move(callback).Run(false); } }
diff --git a/chrome/browser/chromeos/file_manager/file_watcher.h b/chrome/browser/chromeos/file_manager/file_watcher.h index a1aeed6..521a530 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher.h +++ b/chrome/browser/chromeos/file_manager/file_watcher.h
@@ -7,6 +7,7 @@ #include <map> #include <string> +#include <vector> #include "base/callback_forward.h" #include "base/files/file_path.h" @@ -27,7 +28,7 @@ // files is handled differently in EventRouter. class FileWatcher { public: - typedef base::Callback<void(bool success)> BoolCallback; + typedef base::OnceCallback<void(bool success)> BoolCallback; // Creates a FileWatcher associated with the virtual path. explicit FileWatcher(const base::FilePath& virtual_path); @@ -63,12 +64,12 @@ void WatchLocalFile( const base::FilePath& local_path, const base::FilePathWatcher::Callback& file_watcher_callback, - const BoolCallback& callback); + BoolCallback callback); private: // Called when a FilePathWatcher is created and started. // |file_path_watcher| is NULL, if the watcher wasn't started successfully. - void OnWatcherStarted(const BoolCallback& callback, + void OnWatcherStarted(BoolCallback callback, base::FilePathWatcher* file_path_watcher); scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_;
diff --git a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc index 76754d79..d7ebb9b6 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc +++ b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/chromeos/file_manager/file_watcher.h" +#include <utility> + #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/run_loop.h" @@ -26,7 +28,7 @@ : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { } - void FlushMessageLoopTasks() { thread_bundle_.RunUntilIdle(); }; + void FlushMessageLoopTasks() { thread_bundle_.RunUntilIdle(); } private: content::TestBrowserThreadBundle thread_bundle_; @@ -135,7 +137,7 @@ FileWatcher file_watcher(kVirtualPath); file_watcher.AddExtension(kExtensionId); file_watcher.WatchLocalFile(temp_dir.GetPath(), change_callback, - start_callback); + std::move(start_callback)); start_run_loop.Run(); ASSERT_TRUE(watcher_created);
diff --git a/chrome/browser/chromeos/file_manager/fileapi_util.cc b/chrome/browser/chromeos/file_manager/fileapi_util.cc index 08b37514..7c2d186 100644 --- a/chrome/browser/chromeos/file_manager/fileapi_util.cc +++ b/chrome/browser/chromeos/file_manager/fileapi_util.cc
@@ -68,7 +68,7 @@ FileDefinitionListConverter(Profile* profile, const std::string& extension_id, const FileDefinitionList& file_definition_list, - const EntryDefinitionListCallback& callback); + EntryDefinitionListCallback callback); ~FileDefinitionListConverter() = default; private: @@ -98,7 +98,7 @@ scoped_refptr<storage::FileSystemContext> file_system_context_; const std::string extension_id_; const FileDefinitionList file_definition_list_; - const EntryDefinitionListCallback callback_; + EntryDefinitionListCallback callback_; std::unique_ptr<EntryDefinitionList> result_; }; @@ -106,10 +106,10 @@ Profile* profile, const std::string& extension_id, const FileDefinitionList& file_definition_list, - const EntryDefinitionListCallback& callback) + EntryDefinitionListCallback callback) : extension_id_(extension_id), file_definition_list_(file_definition_list), - callback_(callback), + callback_(std::move(callback)), result_(new EntryDefinitionList) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -134,7 +134,7 @@ if (iterator == file_definition_list_.end()) { // The converter object will be destroyed since |self_deleter| gets out of // scope. - callback_.Run(std::move(result_)); + std::move(callback_).Run(std::move(result_)); return; } @@ -216,10 +216,10 @@ // Helper function to return the converted definition entry directly, without // the redundant container. void OnConvertFileDefinitionDone( - const EntryDefinitionCallback& callback, + EntryDefinitionCallback callback, std::unique_ptr<EntryDefinitionList> entry_definition_list) { DCHECK_EQ(1u, entry_definition_list->size()); - callback.Run(entry_definition_list->at(0)); + std::move(callback).Run(entry_definition_list->at(0)); } // Checks if the |file_path| points non-native location or not. @@ -251,10 +251,10 @@ storage::FileSystemContext* context, const GURL& origin, const SelectedFileInfoList& selected_info_list, - const FileChooserFileInfoListCallback& callback) + FileChooserFileInfoListCallback callback) : context_(context), chooser_info_list_(new FileChooserFileInfoList), - callback_(callback) { + callback_(std::move(callback)) { DCHECK_CURRENTLY_ON(BrowserThread::UI); Lifetime lifetime(this); @@ -309,7 +309,7 @@ base::BindOnce( &ConvertSelectedFileInfoListToFileChooserFileInfoListImpl:: FillMetadataOnIOThread, - base::Unretained(this), base::Passed(&lifetime), + base::Unretained(this), std::move(lifetime), chooser_info_list_->begin())); return; } @@ -341,7 +341,7 @@ base::BindOnce( &ConvertSelectedFileInfoListToFileChooserFileInfoListImpl:: NotifyComplete, - base::Unretained(this), base::Passed(&lifetime))); + base::Unretained(this), std::move(lifetime))); return; } @@ -373,7 +373,7 @@ base::BindOnce( &ConvertSelectedFileInfoListToFileChooserFileInfoListImpl:: NotifyError, - base::Unretained(this), base::Passed(&lifetime))); + base::Unretained(this), std::move(lifetime))); return; } @@ -386,7 +386,7 @@ // Returns a result to the |callback_|. void NotifyComplete(Lifetime /* lifetime */) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - callback_.Run(*chooser_info_list_); + std::move(callback_).Run(*chooser_info_list_); // Reset the list so that the file systems are not revoked at the // destructor. chooser_info_list_.reset(); @@ -395,12 +395,12 @@ // Returns an empty list to the |callback_|. void NotifyError(Lifetime /* lifetime */) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - callback_.Run(FileChooserFileInfoList()); + std::move(callback_).Run(FileChooserFileInfoList()); } scoped_refptr<storage::FileSystemContext> context_; std::unique_ptr<FileChooserFileInfoList> chooser_info_list_; - const FileChooserFileInfoListCallback callback_; + FileChooserFileInfoListCallback callback_; DISALLOW_COPY_AND_ASSIGN( ConvertSelectedFileInfoListToFileChooserFileInfoListImpl); @@ -519,38 +519,36 @@ Profile* profile, const std::string& extension_id, const FileDefinitionList& file_definition_list, - const EntryDefinitionListCallback& callback) { + EntryDefinitionListCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); // The converter object destroys itself. - new FileDefinitionListConverter( - profile, extension_id, file_definition_list, callback); + new FileDefinitionListConverter(profile, extension_id, file_definition_list, + std::move(callback)); } void ConvertFileDefinitionToEntryDefinition( Profile* profile, const std::string& extension_id, const FileDefinition& file_definition, - const EntryDefinitionCallback& callback) { + EntryDefinitionCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); FileDefinitionList file_definition_list; file_definition_list.push_back(file_definition); ConvertFileDefinitionListToEntryDefinitionList( - profile, - extension_id, - file_definition_list, - base::Bind(&OnConvertFileDefinitionDone, callback)); + profile, extension_id, file_definition_list, + base::BindOnce(&OnConvertFileDefinitionDone, std::move(callback))); } void ConvertSelectedFileInfoListToFileChooserFileInfoList( storage::FileSystemContext* context, const GURL& origin, const SelectedFileInfoList& selected_info_list, - const FileChooserFileInfoListCallback& callback) { + FileChooserFileInfoListCallback callback) { // The object deletes itself. new ConvertSelectedFileInfoListToFileChooserFileInfoListImpl( - context, origin, selected_info_list, callback); + context, origin, selected_info_list, std::move(callback)); } std::unique_ptr<base::DictionaryValue> ConvertEntryDefinitionToValue(
diff --git a/chrome/browser/chromeos/file_manager/fileapi_util.h b/chrome/browser/chromeos/file_manager/fileapi_util.h index 0d7f7330..919edf60 100644 --- a/chrome/browser/chromeos/file_manager/fileapi_util.h +++ b/chrome/browser/chromeos/file_manager/fileapi_util.h
@@ -9,6 +9,7 @@ #include <memory> #include <string> +#include <vector> #include "base/callback_forward.h" #include "base/files/file.h" @@ -64,19 +65,19 @@ // The callback used by ConvertFileDefinitionToEntryDefinition. Returns the // result of the conversion. -typedef base::Callback<void(const EntryDefinition& entry_definition)> +typedef base::OnceCallback<void(const EntryDefinition& entry_definition)> EntryDefinitionCallback; // The callback used by ConvertFileDefinitionListToEntryDefinitionList. Returns // the result of the conversion as a list. -typedef base::Callback<void( +typedef base::OnceCallback<void( std::unique_ptr<EntryDefinitionList> entry_definition_list)> EntryDefinitionListCallback; // The callback used by // ConvertFileSelectedInfoListToFileChooserFileInfoList. Returns the result of // the conversion as a list. -typedef base::Callback<void(const FileChooserFileInfoList&)> +typedef base::OnceCallback<void(const FileChooserFileInfoList&)> FileChooserFileInfoListCallback; // Returns a file system context associated with the given profile and the @@ -129,7 +130,7 @@ Profile* profile, const std::string& extension_id, const FileDefinition& file_definition, - const EntryDefinitionCallback& callback); + EntryDefinitionCallback callback); // Converts a list of file definitions into a list of entry definitions and // returns it via |callback|. The method is safe, |file_definition_list| is @@ -139,14 +140,14 @@ Profile* profile, const std::string& extension_id, const FileDefinitionList& file_definition_list, - const EntryDefinitionListCallback& callback); + EntryDefinitionListCallback callback); // Converts SelectedFileInfoList into FileChooserFileInfoList. void ConvertSelectedFileInfoListToFileChooserFileInfoList( storage::FileSystemContext* context, const GURL& origin, const SelectedFileInfoList& selected_info_list, - const FileChooserFileInfoListCallback& callback); + FileChooserFileInfoListCallback callback); // Converts EntryDefinition to something File API stack can understand. std::unique_ptr<base::DictionaryValue> ConvertEntryDefinitionToValue(
diff --git a/chrome/browser/chromeos/file_manager/fileapi_util_unittest.cc b/chrome/browser/chromeos/file_manager/fileapi_util_unittest.cc index b26b187d..06f240ba 100644 --- a/chrome/browser/chromeos/file_manager/fileapi_util_unittest.cc +++ b/chrome/browser/chromeos/file_manager/fileapi_util_unittest.cc
@@ -107,10 +107,8 @@ // Run the test target. FileChooserFileInfoList result; ConvertSelectedFileInfoListToFileChooserFileInfoList( - context, - GURL("http://example.com"), - selected_info_list, - base::Bind(&PassFileChooserFileInfoList, &result)); + context, GURL("http://example.com"), selected_info_list, + base::BindOnce(&PassFileChooserFileInfoList, &result)); content::RunAllTasksUntilIdle(); // Check the result.
diff --git a/chrome/browser/chromeos/file_manager/open_util.cc b/chrome/browser/chromeos/file_manager/open_util.cc index 3b83e035..1686c42 100644 --- a/chrome/browser/chromeos/file_manager/open_util.cc +++ b/chrome/browser/chromeos/file_manager/open_util.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/file_manager/open_util.h" +#include <memory> #include <set> #include <string> #include <vector>
diff --git a/chrome/browser/chromeos/file_manager/path_util.cc b/chrome/browser/chromeos/file_manager/path_util.cc index 52b8c9a..5fab836 100644 --- a/chrome/browser/chromeos/file_manager/path_util.cc +++ b/chrome/browser/chromeos/file_manager/path_util.cc
@@ -4,6 +4,9 @@ #include "chrome/browser/chromeos/file_manager/path_util.h" +#include <memory> +#include <utility> + #include "base/barrier_closure.h" #include "base/base64.h" #include "base/logging.h"
diff --git a/chrome/browser/chromeos/file_manager/path_util.h b/chrome/browser/chromeos/file_manager/path_util.h index c9375ac2..3d8bf3b 100644 --- a/chrome/browser/chromeos/file_manager/path_util.h +++ b/chrome/browser/chromeos/file_manager/path_util.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_ #include <string> +#include <vector> #include "base/files/file_path.h" #include "storage/browser/fileapi/file_system_url.h"
diff --git a/chrome/browser/chromeos/file_manager/path_util_unittest.cc b/chrome/browser/chromeos/file_manager/path_util_unittest.cc index 0ce9b1f..c11375b89 100644 --- a/chrome/browser/chromeos/file_manager/path_util_unittest.cc +++ b/chrome/browser/chromeos/file_manager/path_util_unittest.cc
@@ -4,6 +4,9 @@ #include "chrome/browser/chromeos/file_manager/path_util.h" +#include <memory> +#include <utility> + #include "base/files/file_path.h" #include "base/memory/ptr_util.h" #include "base/sys_info.h"
diff --git a/chrome/browser/chromeos/file_manager/url_util.cc b/chrome/browser/chromeos/file_manager/url_util.cc index 21c4ae4f..6eff30d4 100644 --- a/chrome/browser/chromeos/file_manager/url_util.cc +++ b/chrome/browser/chromeos/file_manager/url_util.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include <memory> +#include <utility> #include "base/json/json_writer.h" #include "base/values.h"
diff --git a/chrome/browser/chromeos/file_manager/volume_manager.cc b/chrome/browser/chromeos/file_manager/volume_manager.cc index 5db1fcc..3cb2095e 100644 --- a/chrome/browser/chromeos/file_manager/volume_manager.cc +++ b/chrome/browser/chromeos/file_manager/volume_manager.cc
@@ -389,7 +389,7 @@ chromeos::PowerManagerClient* power_manager_client, chromeos::disks::DiskMountManager* disk_mount_manager, chromeos::file_system_provider::Service* file_system_provider_service, - const GetMtpStorageInfoCallback& get_mtp_storage_info_callback) + GetMtpStorageInfoCallback get_mtp_storage_info_callback) : profile_(profile), drive_integration_service_(drive_integration_service), disk_mount_manager_(disk_mount_manager),
diff --git a/chrome/browser/chromeos/file_manager/volume_manager.h b/chrome/browser/chromeos/file_manager/volume_manager.h index 094e6ab..ad8e7fc 100644 --- a/chrome/browser/chromeos/file_manager/volume_manager.h +++ b/chrome/browser/chromeos/file_manager/volume_manager.h
@@ -264,7 +264,7 @@ chromeos::PowerManagerClient* power_manager_client, chromeos::disks::DiskMountManager* disk_mount_manager, chromeos::file_system_provider::Service* file_system_provider_service, - const GetMtpStorageInfoCallback& get_mtp_storage_info_callback); + GetMtpStorageInfoCallback get_mtp_storage_info_callback); ~VolumeManager() override; // Returns the instance corresponding to the |context|.
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_extensions_external_loader.cc b/chrome/browser/chromeos/login/demo_mode/demo_extensions_external_loader.cc index 0ac01b3a..c9ef1e5a 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_extensions_external_loader.cc +++ b/chrome/browser/chromeos/login/demo_mode/demo_extensions_external_loader.cc
@@ -80,12 +80,14 @@ DemoExtensionsExternalLoader::~DemoExtensionsExternalLoader() = default; void DemoExtensionsExternalLoader::LoadApp(const std::string& app_id) { + app_ids_.push_back(app_id); base::DictionaryValue prefs; - base::DictionaryValue app_dict; - app_dict.SetKey(extensions::ExternalProviderImpl::kExternalUpdateUrl, - base::Value(extension_urls::kChromeWebstoreUpdateURL)); - prefs.SetKey(app_id, std::move(app_dict)); - + for (const std::string& app_id : app_ids_) { + base::DictionaryValue app_dict; + app_dict.SetKey(extensions::ExternalProviderImpl::kExternalUpdateUrl, + base::Value(extension_urls::kChromeWebstoreUpdateURL)); + prefs.SetKey(app_id, std::move(app_dict)); + } if (!external_cache_) { external_cache_ = std::make_unique<ExternalCacheImpl>( cache_dir_, g_browser_process->shared_url_loader_factory(),
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_extensions_external_loader.h b/chrome/browser/chromeos/login/demo_mode/demo_extensions_external_loader.h index 2fe8d53..33f24e96 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_extensions_external_loader.h +++ b/chrome/browser/chromeos/login/demo_mode/demo_extensions_external_loader.h
@@ -71,6 +71,9 @@ const base::FilePath cache_dir_; + // The list of app ids that should be cached by |external_cache_|. + std::vector<std::string> app_ids_; + base::WeakPtrFactory<DemoExtensionsExternalLoader> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(DemoExtensionsExternalLoader);
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_session.cc b/chrome/browser/chromeos/login/demo_mode/demo_session.cc index 91093ed..c1ca61e 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_session.cc +++ b/chrome/browser/chromeos/login/demo_mode/demo_session.cc
@@ -33,6 +33,8 @@ #include "chromeos/dbus/image_loader_client.h" #include "components/prefs/pref_service.h" #include "components/session_manager/core/session_manager.h" +#include "components/user_manager/user.h" +#include "components/user_manager/user_manager.h" #include "content/public/browser/browser_thread.h" #include "extensions/browser/extension_registry.h" #include "extensions/common/constants.h" @@ -96,7 +98,7 @@ base::FilePath src_path = offline_resources_path.Append(kPhotosPath); base::FilePath dest_path = file_manager::util::GetDownloadsFolderForProfile( - ProfileManager::GetPrimaryUserProfile()); + ProfileManager::GetActiveUserProfile()); if (!base::CopyDirectory(src_path, dest_path, false /* recursive */)) LOG(ERROR) << "Failed to install demo mode media."; @@ -243,6 +245,11 @@ return g_demo_session; } +// static +bool DemoSession::IsScreensaverInDemoMode(const std::string& app_id) { + return app_id == extension_misc::kScreensaverAppId && IsDeviceInDemoMode(); +} + void DemoSession::EnsureOfflineResourcesLoaded( base::OnceClosure load_callback) { if (offline_resources_loaded_) { @@ -324,6 +331,12 @@ app_id_or_package) != ignore_pin_policy_offline_apps_.end(); } +void DemoSession::SetExtensionsExternalLoader( + scoped_refptr<DemoExtensionsExternalLoader> extensions_external_loader) { + extensions_external_loader_ = extensions_external_loader; + InstallAppFromUpdateUrl(extension_misc::kScreensaverAppId); +} + void DemoSession::OverrideIgnorePinPolicyAppsForTesting( std::vector<std::string> apps) { ignore_pin_policy_offline_apps_ = std::move(apps); @@ -386,10 +399,10 @@ DCHECK(offline_resources_loaded_); if (offline_resources_path_.empty()) { LOG(ERROR) << "Offline resources not loaded - no highlights app available."; - InstallHighlightsAppFromUpdateUrl(); + InstallAppFromUpdateUrl(GetHighlightsAppId()); return; } - Profile* profile = ProfileManager::GetPrimaryUserProfile(); + Profile* profile = ProfileManager::GetActiveUserProfile(); DCHECK(profile); const base::FilePath resources_path = offline_resources_path_.Append(kHighlightsAppPath); @@ -397,17 +410,24 @@ resources_path, base::CommandLine(base::CommandLine::NO_PROGRAM), base::FilePath() /* cur_dir */)) { LOG(WARNING) << "Failed to launch highlights app from offline resources."; - InstallHighlightsAppFromUpdateUrl(); + InstallAppFromUpdateUrl(GetHighlightsAppId()); } } -void DemoSession::InstallHighlightsAppFromUpdateUrl() { +void DemoSession::InstallAppFromUpdateUrl(const std::string& id) { if (!extensions_external_loader_) return; - Profile* profile = ProfileManager::GetPrimaryUserProfile(); + auto* user = user_manager::UserManager::Get()->GetActiveUser(); + if (!user->is_profile_created()) { + user->AddProfileCreatedObserver( + base::BindOnce(&DemoSession::InstallAppFromUpdateUrl, + weak_ptr_factory_.GetWeakPtr(), id)); + return; + } + Profile* profile = ProfileManager::GetActiveUserProfile(); DCHECK(profile); extension_registry_observer_.Add(extensions::ExtensionRegistry::Get(profile)); - extensions_external_loader_->LoadApp(GetHighlightsAppId()); + extensions_external_loader_->LoadApp(id); } void DemoSession::OnSessionStateChanged() { @@ -425,7 +445,7 @@ bool is_update) { if (extension->id() != GetHighlightsAppId()) return; - Profile* profile = ProfileManager::GetPrimaryUserProfile(); + Profile* profile = ProfileManager::GetActiveUserProfile(); DCHECK(profile); OpenApplication(AppLaunchParams( profile, extension, extensions::LAUNCH_CONTAINER_WINDOW,
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_session.h b/chrome/browser/chromeos/login/demo_mode/demo_session.h index 24b5179d..e95c3cfa 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_session.h +++ b/chrome/browser/chromeos/login/demo_mode/demo_session.h
@@ -89,6 +89,10 @@ // StartIfInDemoMode() or PreloadOfflineResourcesIfInDemoMode()). static DemoSession* Get(); + // Returns whether |app_id| matches the screensaver app and the device is in + // demo mode. + static bool IsScreensaverInDemoMode(const std::string& app_id); + // Ensures that the load of offline demo session resources is requested. // |load_callback| will be run once the offline resource load finishes. void EnsureOfflineResourcesLoaded(base::OnceClosure load_callback); @@ -118,6 +122,10 @@ // in Demo Mode and offline. bool ShouldIgnorePinPolicy(const std::string& app_id_or_package); + // Sets |extensions_external_loader_| and starts installing the screensaver. + void SetExtensionsExternalLoader( + scoped_refptr<DemoExtensionsExternalLoader> extensions_external_loader); + // Sets app IDs and package names that shouldn't be pinned by policy when the // device is offline in Demo Mode. void OverrideIgnorePinPolicyAppsForTesting(std::vector<std::string> apps); @@ -128,11 +136,6 @@ bool offline_resources_loaded() const { return offline_resources_loaded_; } - void set_extensions_external_loader( - scoped_refptr<DemoExtensionsExternalLoader> extensions_external_loader) { - extensions_external_loader_ = extensions_external_loader; - } - private: DemoSession(); ~DemoSession() override; @@ -161,8 +164,8 @@ void LoadAndLaunchHighlightsApp(); // Installs the CRX file from an update URL. Observes |ExtensionRegistry| to - // launch the highlights app upon installation. - void InstallHighlightsAppFromUpdateUrl(); + // launch the app upon installation. + void InstallAppFromUpdateUrl(const std::string& id); // session_manager::SessionManagerObserver: void OnSessionStateChanged() override;
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_setup_browsertest.cc b/chrome/browser/chromeos/login/demo_mode/demo_setup_browsertest.cc index 6916a8b9..03d859f 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_setup_browsertest.cc +++ b/chrome/browser/chromeos/login/demo_mode/demo_setup_browsertest.cc
@@ -713,6 +713,15 @@ ClickScreenDialogButton(OobeScreen::SCREEN_OOBE_EULA, DemoSetupDialog::kEula, OobeButton::kText, JSExecution::kSync); + OobeScreenWaiter(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE).Wait(); + EXPECT_TRUE(IsScreenShown(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE)); + + SetPlayStoreTermsForTesting(); + ClickOobeButtonWithId(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE, + "#arc-tos-next-button", JSExecution::kSync); + ClickOobeButtonWithId(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE, + "#arc-tos-accept-button", JSExecution::kAsync); + OobeScreenWaiter(OobeScreen::SCREEN_OOBE_DEMO_SETUP).Wait(); // TODO(agawronska): Progress dialog transition is async - extra work is // needed to be able to check it reliably. @@ -757,6 +766,15 @@ ClickScreenDialogButton(OobeScreen::SCREEN_OOBE_EULA, DemoSetupDialog::kEula, OobeButton::kText, JSExecution::kSync); + OobeScreenWaiter(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE).Wait(); + EXPECT_TRUE(IsScreenShown(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE)); + + SetPlayStoreTermsForTesting(); + ClickOobeButtonWithId(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE, + "#arc-tos-next-button", JSExecution::kSync); + ClickOobeButtonWithId(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE, + "#arc-tos-accept-button", JSExecution::kAsync); + OobeScreenWaiter(OobeScreen::SCREEN_OOBE_DEMO_SETUP).Wait(); // TODO(agawronska): Progress dialog transition is async - extra work is // needed to be able to check it reliably.
diff --git a/chrome/browser/chromeos/login/lock/webui_screen_locker.cc b/chrome/browser/chromeos/login/lock/webui_screen_locker.cc index 4c61ade..c07f6d6 100644 --- a/chrome/browser/chromeos/login/lock/webui_screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/webui_screen_locker.cc
@@ -382,10 +382,6 @@ //////////////////////////////////////////////////////////////////////////////// // display::DisplayObserver: -void WebUIScreenLocker::OnDisplayAdded(const display::Display& new_display) {} - -void WebUIScreenLocker::OnDisplayRemoved(const display::Display& old_display) {} - void WebUIScreenLocker::OnDisplayMetricsChanged(const display::Display& display, uint32_t changed_metrics) { display::Display primary_display =
diff --git a/chrome/browser/chromeos/login/lock/webui_screen_locker.h b/chrome/browser/chromeos/login/lock/webui_screen_locker.h index a06ecc3a..1b9bfcd 100644 --- a/chrome/browser/chromeos/login/lock/webui_screen_locker.h +++ b/chrome/browser/chromeos/login/lock/webui_screen_locker.h
@@ -112,8 +112,6 @@ void RenderProcessGone(base::TerminationStatus status) override; // display::DisplayObserver: - void OnDisplayAdded(const display::Display& new_display) override; - void OnDisplayRemoved(const display::Display& old_display) override; void OnDisplayMetricsChanged(const display::Display& display, uint32_t changed_metrics) override;
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 5850878..82ff67d 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -922,8 +922,9 @@ if (is_official_build_) { if (!StartupUtils::IsEulaAccepted()) { ShowEulaScreen(); + } else if (arc::IsArcTermsOfServiceOobeNegotiationNeeded()) { + ShowArcTermsOfServiceScreen(); } else { - // TODO(crbug.com/857275): Show Play Store ToS when available offline. ShowDemoModeSetupScreen(); } } else { @@ -958,15 +959,11 @@ weak_factory_.GetWeakPtr())); PerformPostEulaActions(); - // TODO(crbug.com/857275): Show Play Store ToS when available offline. - if (demo_setup_controller_ && demo_setup_controller_->IsOfflineEnrollment()) { - ShowDemoModeSetupScreen(); - return; - } - if (arc::IsArcTermsOfServiceOobeNegotiationNeeded()) { ShowArcTermsOfServiceScreen(); return; + } else if (demo_setup_controller_) { + ShowDemoModeSetupScreen(); } if (skip_update_enroll_after_eula_) { @@ -1116,7 +1113,11 @@ void WizardController::OnArcTermsOfServiceAccepted() { if (demo_setup_controller_) { - InitiateOOBEUpdate(); + if (demo_setup_controller_->IsOfflineEnrollment()) { + ShowDemoModeSetupScreen(); + } else { + InitiateOOBEUpdate(); + } return; }
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index 1ee915c6..44384037 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -2201,10 +2201,20 @@ EXPECT_TRUE(DemoSetupController::IsOobeDemoSetupFlowInProgress()); EXPECT_CALL(*mock_eula_screen_, Hide()).Times(1); - EXPECT_CALL(*mock_demo_setup_screen_, Show()).Times(1); + EXPECT_CALL(*mock_arc_terms_of_service_screen_, Show()).Times(1); OnExit(ScreenExitCode::EULA_ACCEPTED); + CheckCurrentScreen(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE); + EXPECT_TRUE(DemoSetupController::IsOobeDemoSetupFlowInProgress()); + + EXPECT_CALL(*mock_arc_terms_of_service_screen_, Hide()).Times(1); + EXPECT_CALL(*mock_demo_setup_screen_, Show()).Times(1); + + OnExit(ScreenExitCode::ARC_TERMS_OF_SERVICE_ACCEPTED); + + base::RunLoop().RunUntilIdle(); + CheckCurrentScreen(OobeScreen::SCREEN_OOBE_DEMO_SETUP); EXPECT_TRUE(DemoSetupController::IsOobeDemoSetupFlowInProgress());
diff --git a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc index 1f1a49f..094b168 100644 --- a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc +++ b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc
@@ -208,7 +208,8 @@ ASSERT_TRUE(profile_manager_.SetUp()); chromeos::DeviceOAuth2TokenServiceFactory::Initialize( - test_shared_loader_factory_); + test_shared_loader_factory_, + TestingBrowserProcess::GetGlobal()->local_state()); invalidation::DeprecatedProfileInvalidationProviderFactory::GetInstance() ->RegisterTestingFactory(BuildProfileInvalidationProvider);
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc index 86b6bcf..6e5d2a1 100644 --- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc
@@ -162,16 +162,16 @@ RegisterLocalState(local_state_.registry()); manager_->Init(&schema_registry_); - // DeviceOAuth2TokenService uses the system url loader factory fetch - // OAuth tokens, then writes the token to local state, encrypting it - // first with methods in CryptohomeTokenEncryptor. + // SharedURLLoaderFactory and LocalState singletons have to be set since + // they are accessed by EnrollmentHandlerChromeOS and StartupUtils. TestingBrowserProcess::GetGlobal()->SetSharedURLLoaderFactory( test_shared_loader_factory_); TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); + // SystemSaltGetter is used in DeviceOAuth2TokenService. chromeos::SystemSaltGetter::Initialize(); chromeos::DeviceOAuth2TokenServiceFactory::Initialize( - test_shared_loader_factory_); + test_shared_loader_factory_, &local_state_); url_fetcher_response_code_ = net::HTTP_OK; url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\","
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service_delegate.cc b/chrome/browser/chromeos/settings/device_oauth2_token_service_delegate.cc index eb9d85d..6d963e995 100644 --- a/chrome/browser/chromeos/settings/device_oauth2_token_service_delegate.cc +++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_delegate.cc
@@ -11,7 +11,6 @@ #include "base/bind_helpers.h" #include "base/memory/weak_ptr.h" #include "base/values.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/settings/token_encryptor.h" #include "chrome/common/pref_names.h" #include "chromeos/cryptohome/system_salt_getter.h" @@ -281,8 +280,8 @@ state_ = STATE_VALIDATION_STARTED; - gaia_oauth_client_.reset(new gaia::GaiaOAuthClient( - g_browser_process->shared_url_loader_factory())); + gaia_oauth_client_ = + std::make_unique<gaia::GaiaOAuthClient>(url_loader_factory_); GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); gaia::OAuthClientInfo client_info;
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc index 72425e2a..3fef576 100644 --- a/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc +++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" #include "chrome/browser/chromeos/settings/device_oauth2_token_service_delegate.h" #include "chrome/browser/chromeos/settings/token_encryptor.h" @@ -29,19 +28,15 @@ return g_device_oauth2_token_service_; } -void DeviceOAuth2TokenServiceFactory::Initialize() { - Initialize(g_browser_process->system_network_context_manager() - ->GetSharedURLLoaderFactory()); -} - // static void DeviceOAuth2TokenServiceFactory::Initialize( - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) { + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + PrefService* local_state) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(!g_device_oauth2_token_service_); g_device_oauth2_token_service_ = new DeviceOAuth2TokenService( - std::make_unique<DeviceOAuth2TokenServiceDelegate>( - url_loader_factory, g_browser_process->local_state())); + std::make_unique<DeviceOAuth2TokenServiceDelegate>(url_loader_factory, + local_state)); } // static
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h index e8a951cd..7bbd1a2 100644 --- a/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h +++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
@@ -11,6 +11,8 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" +class PrefService; + namespace network { class SharedURLLoaderFactory; } @@ -31,13 +33,10 @@ // Called by ChromeBrowserMainPartsChromeOS in order to bootstrap the // DeviceOAuth2TokenService instance after the required global data is - // available (local state, request context getter and CrosSettings). - static void Initialize(); - - // Same as |Initialize()| but uses |url_loader_factory| for fetching OAuth - // tokens. Used in tests. + // available (local state, url loader and CrosSettings). static void Initialize( - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + PrefService* local_state); // Called by ChromeBrowserMainPartsChromeOS in order to shutdown the // DeviceOAuth2TokenService instance and cancel all in-flight requests before
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc b/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc index c6fcfd4..db4f6c8 100644 --- a/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc +++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc
@@ -17,7 +17,7 @@ #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/device_oauth2_token_service_delegate.h" #include "chrome/browser/chromeos/settings/device_settings_service.h" -#include "chrome/browser/chromeos/settings/stub_install_attributes.h" +#include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" #include "chrome/browser/chromeos/settings/token_encryptor.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/scoped_testing_local_state.h" @@ -67,10 +67,7 @@ : scoped_testing_local_state_(TestingBrowserProcess::GetGlobal()), test_shared_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( - &test_url_loader_factory_)) { - TestingBrowserProcess::GetGlobal()->SetSharedURLLoaderFactory( - test_shared_loader_factory_); - } + &test_url_loader_factory_)) {} // Most tests just want a noop crypto impl with a dummy refresh token value in // Local State (if the value is an empty string, it will be ignored). @@ -113,26 +110,19 @@ SystemSaltGetter::Initialize(); - DeviceSettingsService::Initialize(); scoped_refptr<ownership::MockOwnerKeyUtil> owner_key_util_( new ownership::MockOwnerKeyUtil()); owner_key_util_->SetPublicKeyFromPrivateKey( *device_policy_.GetSigningKey()); DeviceSettingsService::Get()->SetSessionManager(&session_manager_client_, owner_key_util_); - - CrosSettings::Initialize(); } void TearDown() override { - TestingBrowserProcess::GetGlobal()->SetSharedURLLoaderFactory(nullptr); oauth2_service_.reset(); test_shared_loader_factory_->Detach(); - CrosSettings::Shutdown(); - TestingBrowserProcess::GetGlobal()->ShutdownBrowserPolicyConnector(); base::TaskScheduler::GetInstance()->FlushForTesting(); DeviceSettingsService::Get()->UnsetSessionManager(); - DeviceSettingsService::Shutdown(); SystemSaltGetter::Shutdown(); DBusThreadManager::Shutdown(); base::RunLoop().RunUntilIdle(); @@ -211,7 +201,7 @@ }; content::TestBrowserThreadBundle test_browser_thread_bundle_; - ScopedStubInstallAttributes test_install_attributes_; + ScopedCrosSettingsTestHelper cros_settings_test_helper_; ScopedTestingLocalState scoped_testing_local_state_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::WeakWrapperSharedURLLoaderFactory>
diff --git a/chrome/browser/chromeos/smb_client/smb_errors.cc b/chrome/browser/chromeos/smb_client/smb_errors.cc index fd309d1a..81acd5d 100644 --- a/chrome/browser/chromeos/smb_client/smb_errors.cc +++ b/chrome/browser/chromeos/smb_client/smb_errors.cc
@@ -112,13 +112,14 @@ return SmbMountResult::MOUNT_EXISTS; case smbprovider::ERROR_NOT_FOUND: case smbprovider::ERROR_NOT_A_DIRECTORY: - case smbprovider::ERROR_INVALID_URL: return SmbMountResult::NOT_FOUND; case smbprovider::ERROR_ACCESS_DENIED: case smbprovider::ERROR_SECURITY: return SmbMountResult::AUTHENTICATION_FAILED; case smbprovider::ERROR_SMB1_UNSUPPORTED: return SmbMountResult::UNSUPPORTED_DEVICE; + case smbprovider::ERROR_INVALID_URL: + return SmbMountResult::INVALID_URL; case smbprovider::ERROR_FAILED: case smbprovider::ERROR_TOO_MANY_OPENED: case smbprovider::ERROR_NO_MEMORY:
diff --git a/chrome/browser/chromeos/smb_client/smb_errors.h b/chrome/browser/chromeos/smb_client/smb_errors.h index 0262752..a7cf402 100644 --- a/chrome/browser/chromeos/smb_client/smb_errors.h +++ b/chrome/browser/chromeos/smb_client/smb_errors.h
@@ -23,7 +23,8 @@ NOT_FOUND = 3, // The specified share was not found. UNSUPPORTED_DEVICE = 4, // The specified share is not supported. MOUNT_EXISTS = 5, // The specified share is already mounted. - kMaxValue = MOUNT_EXISTS // Max enum value for use in metrics. + INVALID_URL = 6, // The mount URL is an invalid SMB URL. + kMaxValue = INVALID_URL // Max enum value for use in metrics. }; // Translates an smbprovider::ErrorType to a base::File::Error. Since
diff --git a/chrome/browser/chromeos/smb_client/smb_errors_unittest.cc b/chrome/browser/chromeos/smb_client/smb_errors_unittest.cc index d0c2e01..37b851e 100644 --- a/chrome/browser/chromeos/smb_client/smb_errors_unittest.cc +++ b/chrome/browser/chromeos/smb_client/smb_errors_unittest.cc
@@ -127,7 +127,7 @@ TranslateErrorToMountResult(smbprovider::ERROR_NOT_A_FILE)); EXPECT_EQ(SmbMountResult::UNKNOWN_FAILURE, TranslateErrorToMountResult(smbprovider::ERROR_NOT_EMPTY)); - EXPECT_EQ(SmbMountResult::NOT_FOUND, + EXPECT_EQ(SmbMountResult::INVALID_URL, TranslateErrorToMountResult(smbprovider::ERROR_INVALID_URL)); EXPECT_EQ(SmbMountResult::UNKNOWN_FAILURE, TranslateErrorToMountResult(smbprovider::ERROR_IO)); @@ -169,7 +169,7 @@ TranslateErrorToMountResult(base::File::FILE_ERROR_NOT_A_FILE)); EXPECT_EQ(SmbMountResult::UNKNOWN_FAILURE, TranslateErrorToMountResult(base::File::FILE_ERROR_NOT_EMPTY)); - EXPECT_EQ(SmbMountResult::NOT_FOUND, + EXPECT_EQ(SmbMountResult::INVALID_URL, TranslateErrorToMountResult(base::File::FILE_ERROR_INVALID_URL)); EXPECT_EQ(SmbMountResult::UNKNOWN_FAILURE, TranslateErrorToMountResult(base::File::FILE_ERROR_IO));
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 9289883..b49ced8 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -284,7 +284,8 @@ void Wait(); private: // Invoked when the beforeunload handler fires. - void BeforeUnloadFired(const base::TimeTicks& proceed_time) override; + void BeforeUnloadFired(bool proceed, + const base::TimeTicks& proceed_time) override; bool m_fired; scoped_refptr<content::MessageLoopRunner> message_loop_runner_; @@ -306,6 +307,7 @@ } void DevToolsWindowBeforeUnloadObserver::BeforeUnloadFired( + bool proceed, const base::TimeTicks& proceed_time) { m_fired = true; if (message_loop_runner_.get())
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc index ee982a6..fd99d17 100644 --- a/chrome/browser/devtools/devtools_window.cc +++ b/chrome/browser/devtools/devtools_window.cc
@@ -867,8 +867,11 @@ window->intercepted_page_beforeunload_ = true; // Handle case of devtools inspecting another devtools instance by passing // the call up to the inspecting devtools instance. + // TODO(chrisha): Make devtools handle |auto_cancel=false| unload handler + // dispatches; otherwise, discarding queries can cause unload dialogs to + // pop-up for tabs with an attached devtools. if (!DevToolsWindow::InterceptPageBeforeUnload(window->main_web_contents_)) { - window->main_web_contents_->DispatchBeforeUnload(); + window->main_web_contents_->DispatchBeforeUnload(false /* auto_cancel */); } return true; } @@ -1229,7 +1232,7 @@ // Inspected page is attempting to close. WebContents* inspected_web_contents = GetInspectedWebContents(); if (proceed) { - inspected_web_contents->DispatchBeforeUnload(); + inspected_web_contents->DispatchBeforeUnload(false /* auto_cancel */); } else { bool should_proceed; inspected_web_contents->GetDelegate()->BeforeUnloadFired( @@ -1299,7 +1302,7 @@ void DevToolsWindow::CloseWindow() { DCHECK(is_docked_); life_stage_ = kClosing; - main_web_contents_->DispatchBeforeUnload(); + main_web_contents_->DispatchBeforeUnload(false /* auto_cancel */); } void DevToolsWindow::Inspect(scoped_refptr<content::DevToolsAgentHost> host) {
diff --git a/chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api.cc b/chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api.cc index 3a75d92..4a9e3441 100644 --- a/chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api.cc +++ b/chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api.cc
@@ -7,7 +7,10 @@ #include <utility> #include "base/bind.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/enterprise_hardware_platform.h" +#include "chrome/common/pref_names.h" +#include "components/prefs/pref_service.h" namespace extensions { @@ -19,6 +22,14 @@ ExtensionFunction::ResponseAction EnterpriseHardwarePlatformGetHardwarePlatformInfoFunction::Run() { + Profile* profile = Profile::FromBrowserContext(browser_context()); + if (!profile->GetPrefs()->IsManagedPreference( + prefs::kEnterpriseHardwarePlatformAPIEnabled) || + !profile->GetPrefs()->GetBoolean( + prefs::kEnterpriseHardwarePlatformAPIEnabled)) { + return RespondNow(Error("Not allowed")); + } + base::SysInfo::GetHardwareInfo(base::BindOnce( &EnterpriseHardwarePlatformGetHardwarePlatformInfoFunction:: OnHardwarePlatformInfo,
diff --git a/chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api_unittest.cc b/chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api_unittest.cc index 285c636..5c9bb05 100644 --- a/chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api_unittest.cc +++ b/chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api_unittest.cc
@@ -6,13 +6,12 @@ #include <memory> #include <string> +#include <utility> -#include "base/json/json_writer.h" -#include "chrome/browser/extensions/extension_api_unittest.h" -#include "chrome/browser/extensions/extension_function_test_utils.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service_test_with_install.h" -#include "components/crx_file/id_util.h" +#include "chrome/common/pref_names.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" +#include "extensions/browser/api_test_utils.h" #include "extensions/common/extension_builder.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,47 +22,44 @@ public: EnterpriseHardwarePlatformAPITest() = default; ~EnterpriseHardwarePlatformAPITest() override = default; - Browser* browser() { return browser_.get(); } + + protected: + EnterpriseHardwarePlatformGetHardwarePlatformInfoFunction* function() { + return function_.get(); + } private: void SetUp() override { ExtensionServiceTestWithInstall::SetUp(); - InitializeEmptyExtensionService(); - browser_window_ = std::make_unique<TestBrowserWindow>(); - Browser::CreateParams params(profile(), true); - params.type = Browser::TYPE_TABBED; - params.window = browser_window_.get(); - browser_ = std::make_unique<Browser>(params); + InitializeExtensionService(ExtensionServiceInitParams()); + + extension_ = ExtensionBuilder("Test").Build(); + function_ = new EnterpriseHardwarePlatformGetHardwarePlatformInfoFunction(); + function_->set_extension(extension_.get()); + function_->set_has_callback(true); } void TearDown() override { - browser_.reset(); - browser_window_.reset(); + function_.reset(); + extension_.reset(); ExtensionServiceTestWithInstall::TearDown(); } - std::unique_ptr<TestBrowserWindow> browser_window_; - std::unique_ptr<Browser> browser_; + scoped_refptr<const Extension> extension_; + scoped_refptr<EnterpriseHardwarePlatformGetHardwarePlatformInfoFunction> + function_; DISALLOW_COPY_AND_ASSIGN(EnterpriseHardwarePlatformAPITest); }; -TEST_F(EnterpriseHardwarePlatformAPITest, GetHardwarePlatformInfo) { - scoped_refptr<const Extension> extension = ExtensionBuilder("Test").Build(); - scoped_refptr<EnterpriseHardwarePlatformGetHardwarePlatformInfoFunction> - function = - new EnterpriseHardwarePlatformGetHardwarePlatformInfoFunction(); - function->set_extension(extension.get()); - function->set_has_callback(true); +TEST_F(EnterpriseHardwarePlatformAPITest, GetHardwarePlatformInfoAllowed) { + testing_pref_service()->SetManagedPref( + prefs::kEnterpriseHardwarePlatformAPIEnabled, + std::make_unique<base::Value>(true)); - std::string args; - base::JSONWriter::Write(base::ListValue(), &args); - - std::unique_ptr<base::Value> result( - extension_function_test_utils::RunFunctionAndReturnSingleResult( - function.get(), args, browser())); - base::RunLoop().RunUntilIdle(); - + std::unique_ptr<base::Value> result = + api_test_utils::RunFunctionAndReturnSingleResult(function(), "[]", + browser_context()); ASSERT_TRUE(result); ASSERT_TRUE(result->is_dict()); ASSERT_EQ(result->DictSize(), 2u); @@ -81,4 +77,20 @@ EXPECT_FALSE(model.empty()); } +TEST_F(EnterpriseHardwarePlatformAPITest, + GetHardwarePlatformInfoNotAllowedExplicit) { + testing_pref_service()->SetDefaultPrefValue( + prefs::kEnterpriseHardwarePlatformAPIEnabled, base::Value(false)); + std::string error = api_test_utils::RunFunctionAndReturnError( + function(), "[]", browser_context()); + EXPECT_FALSE(error.empty()); +} + +TEST_F(EnterpriseHardwarePlatformAPITest, + GetHardwarePlatformInfoNotAllowedImplicit) { + std::string error = api_test_utils::RunFunctionAndReturnError( + function(), "[]", browser_context()); + EXPECT_FALSE(error.empty()); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc index 0fae4f18..05371efe 100644 --- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
@@ -25,6 +25,7 @@ #include "chrome/browser/sessions/session_tab_helper.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_switches.h" #include "content/public/browser/desktop_media_id.h" @@ -192,6 +193,27 @@ } } +// Find the last-active browser that matches a profile this ExtensionFunction +// can access. We can't use FindLastActiveWithProfile() because we may want to +// include incognito profile browsers. +Browser* GetLastActiveBrowser(const Profile* profile, + const bool match_incognito_profile) { + BrowserList* browser_list = BrowserList::GetInstance(); + Browser* target_browser = nullptr; + for (auto iter = browser_list->begin_last_active(); + iter != browser_list->end_last_active(); ++iter) { + Profile* browser_profile = (*iter)->profile(); + if (browser_profile == profile || + (match_incognito_profile && + browser_profile->GetOriginalProfile() == profile)) { + target_browser = *iter; + break; + } + } + + return target_browser; +} + } // namespace // Whitelisted extensions that do not check for a browser action grant because @@ -208,9 +230,10 @@ TabCapture::Capture::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(params); - // Figure out the active WebContents and retrieve the needed ids. - Browser* target_browser = chrome::FindLastActiveWithProfile( - Profile::FromBrowserContext(browser_context())); + Profile* profile = Profile::FromBrowserContext(browser_context()); + const bool match_incognito_profile = include_incognito_information(); + Browser* target_browser = + GetLastActiveBrowser(profile, match_incognito_profile); if (!target_browser || target_browser->type() != Browser::TYPE_TABBED) return RespondNow(Error(kFindingTabError)); @@ -394,9 +417,10 @@ return RespondNow(Error(kInvalidTabIdError)); } } else { - // Figure out the active WebContents and retrieve the needed ids. - Browser* target_browser = chrome::FindLastActiveWithProfile( - Profile::FromBrowserContext(browser_context())); + Profile* profile = Profile::FromBrowserContext(browser_context()); + const bool match_incognito_profile = include_incognito_information(); + Browser* target_browser = + GetLastActiveBrowser(profile, match_incognito_profile); if (!target_browser || target_browser->type() != Browser::TYPE_TABBED) return RespondNow(Error(kFindingTabError));
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc index c99f1db..d4b100e 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -32,7 +32,6 @@ #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/menu_manager.h" #include "chrome/browser/extensions/updater/chrome_update_client_config.h" -#include "chrome/browser/extensions/user_script_listener.h" #include "chrome/browser/external_protocol/external_protocol_handler.h" #include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/profiles/profile.h" @@ -537,14 +536,6 @@ return g_browser_process->system_network_context_manager()->GetContext(); } -UserScriptListener* ChromeExtensionsBrowserClient::GetUserScriptListener() { - // Create lazily since this accesses g_browser_process which may not be set up - // when ChromeExtensionsBrowserClient is created. - if (!user_script_listener_) - user_script_listener_ = std::make_unique<UserScriptListener>(); - return user_script_listener_.get(); -} - // static void ChromeExtensionsBrowserClient::set_did_chrome_update_for_testing( bool did_update) {
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.h b/chrome/browser/extensions/chrome_extensions_browser_client.h index fdbc265..c22ee9a 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.h +++ b/chrome/browser/extensions/chrome_extensions_browser_client.h
@@ -151,7 +151,6 @@ content::BrowserContext* context) const override; bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) override; network::mojom::NetworkContext* GetSystemNetworkContext() override; - UserScriptListener* GetUserScriptListener() override; static void set_did_chrome_update_for_testing(bool did_update); @@ -170,8 +169,6 @@ std::unique_ptr<KioskDelegate> kiosk_delegate_; - std::unique_ptr<UserScriptListener> user_script_listener_; - DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserClient); };
diff --git a/chrome/browser/extensions/external_provider_impl.cc b/chrome/browser/extensions/external_provider_impl.cc index 2ef26c9..0fe8e8ea 100644 --- a/chrome/browser/extensions/external_provider_impl.cc +++ b/chrome/browser/extensions/external_provider_impl.cc
@@ -707,7 +707,7 @@ Manifest::EXTERNAL_PREF_DOWNLOAD, Extension::NO_FLAGS); demo_apps_provider->set_auto_acknowledge(true); demo_apps_provider->set_install_immediately(true); - chromeos::DemoSession::Get()->set_extensions_external_loader(loader); + chromeos::DemoSession::Get()->SetExtensionsExternalLoader(loader); provider_list->push_back(std::move(demo_apps_provider)); }
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc index e31baeb..477616f 100644 --- a/chrome/browser/extensions/tab_helper.cc +++ b/chrome/browser/extensions/tab_helper.cc
@@ -224,7 +224,7 @@ if (extension_app_) { SessionTabHelper::FromWebContents(web_contents()) - ->SetTabExtensionAppID(extension_app_->id()); + ->SetTabExtensionAppID(GetAppId()); } } @@ -234,9 +234,13 @@ SetExtensionApp(extension); } +ExtensionId TabHelper::GetAppId() const { + return extension_app_ ? extension_app_->id() : ExtensionId(); +} + SkBitmap* TabHelper::GetExtensionAppIcon() { if (extension_app_icon_.empty()) - return NULL; + return nullptr; return &extension_app_icon_; } @@ -328,7 +332,7 @@ CreateForWebContents(new_web_contents); TabHelper* new_helper = FromWebContents(new_web_contents); - new_helper->SetExtensionApp(extension_app()); + new_helper->SetExtensionApp(extension_app_); new_helper->extension_app_icon_ = extension_app_icon_; }
diff --git a/chrome/browser/extensions/tab_helper.h b/chrome/browser/extensions/tab_helper.h index 6fbeba6..9dd5aee 100644 --- a/chrome/browser/extensions/tab_helper.h +++ b/chrome/browser/extensions/tab_helper.h
@@ -75,11 +75,12 @@ // specified id. void SetExtensionAppById(const ExtensionId& extension_app_id); - const Extension* extension_app() const { return extension_app_; } - bool is_app() const { return extension_app_ != NULL; } - const WebApplicationInfo& web_app_info() const { - return web_app_info_; - } + // Returns true if an app extension has been set. + bool is_app() const { return extension_app_ != nullptr; } + + // Return ExtensionId for extension app. + // If an app extension has not been set, returns empty id. + ExtensionId GetAppId() const; // If an app extension has been explicitly set for this WebContents its icon // is returned.
diff --git a/chrome/browser/extensions/tab_helper_unittest.cc b/chrome/browser/extensions/tab_helper_unittest.cc index 6ebc62e..f8031ac 100644 --- a/chrome/browser/extensions/tab_helper_unittest.cc +++ b/chrome/browser/extensions/tab_helper_unittest.cc
@@ -22,12 +22,12 @@ TabHelper::CreateForWebContents(web_contents.get()); TabHelper* tab_helper = TabHelper::FromWebContents(web_contents.get()); tab_helper->SetExtensionApp(extension); - EXPECT_EQ(extension, tab_helper->extension_app()); + EXPECT_EQ(extension->id(), tab_helper->GetAppId()); EXPECT_TRUE(tab_helper->is_app()); service()->UnloadExtension(extension->id(), UnloadedExtensionReason::UNDEFINED); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(nullptr, tab_helper->extension_app()); + EXPECT_EQ(ExtensionId(), tab_helper->GetAppId()); } } // namespace extensions
diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc index 207ebb3..a5252f35 100644 --- a/chrome/browser/extensions/user_script_listener.cc +++ b/chrome/browser/extensions/user_script_listener.cc
@@ -13,26 +13,26 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/navigation_handle.h" -#include "content/public/browser/navigation_throttle.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/resource_throttle.h" #include "extensions/browser/extension_registry.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_handlers/content_scripts_handler.h" #include "extensions/common/url_pattern.h" +#include "net/url_request/url_request.h" using content::BrowserThread; -using content::NavigationThrottle; +using content::ResourceThrottle; using content::ResourceType; namespace extensions { class UserScriptListener::Throttle - : public NavigationThrottle, + : public ResourceThrottle, public base::SupportsWeakPtr<UserScriptListener::Throttle> { public: - explicit Throttle(content::NavigationHandle* navigation_handle) - : NavigationThrottle(navigation_handle) {} + Throttle() : should_defer_(true), did_defer_(false) { + } void ResumeIfDeferred() { DCHECK(should_defer_); @@ -45,24 +45,23 @@ } } - // NavigationThrottle implementation: - ThrottleCheckResult WillStartRequest() override { + // ResourceThrottle implementation: + void WillStartRequest(bool* defer) override { // Only defer requests if Resume has not yet been called. if (should_defer_) { + *defer = true; did_defer_ = true; timer_.reset(new base::ElapsedTimer()); - return DEFER; } - return PROCEED; } - const char* GetNameForLogging() override { + const char* GetNameForLogging() const override { return "UserScriptListener::Throttle"; } private: - bool should_defer_ = true; - bool did_defer_ = false; + bool should_defer_; + bool did_defer_; std::unique_ptr<base::ElapsedTimer> timer_; DISALLOW_COPY_AND_ASSIGN(Throttle); @@ -71,21 +70,21 @@ struct UserScriptListener::ProfileData { // True if the user scripts contained in |url_patterns| are ready for // injection. - bool user_scripts_ready = false; + bool user_scripts_ready; // A list of URL patterns that have will have user scripts applied to them. URLPatterns url_patterns; + + ProfileData() : user_scripts_ready(false) {} }; -UserScriptListener::UserScriptListener() : extension_registry_observer_(this) { +UserScriptListener::UserScriptListener() + : user_scripts_ready_(false), extension_registry_observer_(this) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - // Profile manager can be null in unit tests. - if (g_browser_process->profile_manager()) { - for (auto* profile : - g_browser_process->profile_manager()->GetLoadedProfiles()) { - extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); - } + for (auto* profile : + g_browser_process->profile_manager()->GetLoadedProfiles()) { + extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); } registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, @@ -98,27 +97,30 @@ content::NotificationService::AllSources()); } -std::unique_ptr<NavigationThrottle> -UserScriptListener::CreateNavigationThrottle( - content::NavigationHandle* navigation_handle) { - if (!ShouldDelayRequest(navigation_handle->GetURL())) - return nullptr; +ResourceThrottle* UserScriptListener::CreateResourceThrottle( + const GURL& url, + ResourceType resource_type) { + if (!ShouldDelayRequest(url, resource_type)) + return NULL; - auto throttle = std::make_unique<Throttle>(navigation_handle); + Throttle* throttle = new Throttle(); throttles_.push_back(throttle->AsWeakPtr()); return throttle; } -void UserScriptListener::SetUserScriptsNotReadyForTesting( - content::BrowserContext* context) { - AppendNewURLPatterns(context, {URLPattern(URLPattern::SCHEME_ALL, - URLPattern::kAllUrlsPattern)}); +UserScriptListener::~UserScriptListener() { } -UserScriptListener::~UserScriptListener() {} +bool UserScriptListener::ShouldDelayRequest(const GURL& url, + ResourceType resource_type) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); -bool UserScriptListener::ShouldDelayRequest(const GURL& url) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); + // If it's a frame load, then we need to check the URL against the list of + // user scripts to see if we need to wait. + if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME && + resource_type != content::RESOURCE_TYPE_SUB_FRAME) + return false; + // Note: we could delay only requests made by the profile who is causing the // delay, but it's a little more complicated to associate requests with the // right profile. Since this is a rare case, we'll just take the easy way @@ -153,7 +155,7 @@ } void UserScriptListener::CheckIfAllUserScriptsReady() { - DCHECK_CURRENTLY_ON(BrowserThread::UI); + DCHECK_CURRENTLY_ON(BrowserThread::IO); bool was_ready = user_scripts_ready_; user_scripts_ready_ = true; @@ -167,39 +169,39 @@ StartDelayedRequests(); } -void UserScriptListener::UserScriptsReady(content::BrowserContext* context) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); +void UserScriptListener::UserScriptsReady(void* profile_id) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); - profile_data_[context].user_scripts_ready = true; + profile_data_[profile_id].user_scripts_ready = true; CheckIfAllUserScriptsReady(); } -void UserScriptListener::ProfileDestroyed(content::BrowserContext* context) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - profile_data_.erase(context); +void UserScriptListener::ProfileDestroyed(void* profile_id) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + profile_data_.erase(profile_id); // We may have deleted the only profile we were waiting on. CheckIfAllUserScriptsReady(); } -void UserScriptListener::AppendNewURLPatterns(content::BrowserContext* context, +void UserScriptListener::AppendNewURLPatterns(void* profile_id, const URLPatterns& new_patterns) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); + DCHECK_CURRENTLY_ON(BrowserThread::IO); user_scripts_ready_ = false; - ProfileData& data = profile_data_[context]; + ProfileData& data = profile_data_[profile_id]; data.user_scripts_ready = false; data.url_patterns.insert(data.url_patterns.end(), new_patterns.begin(), new_patterns.end()); } -void UserScriptListener::ReplaceURLPatterns(content::BrowserContext* context, +void UserScriptListener::ReplaceURLPatterns(void* profile_id, const URLPatterns& patterns) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); + DCHECK_CURRENTLY_ON(BrowserThread::IO); - ProfileData& data = profile_data_[context]; + ProfileData& data = profile_data_[profile_id]; data.url_patterns = patterns; } @@ -229,12 +231,16 @@ } case chrome::NOTIFICATION_PROFILE_DESTROYED: { Profile* profile = content::Source<Profile>(source).ptr(); - ProfileDestroyed(profile); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&UserScriptListener::ProfileDestroyed, this, profile)); break; } case extensions::NOTIFICATION_USER_SCRIPTS_UPDATED: { Profile* profile = content::Source<Profile>(source).ptr(); - UserScriptsReady(profile); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&UserScriptListener::UserScriptsReady, this, profile)); break; } default: @@ -251,7 +257,10 @@ URLPatterns new_patterns; CollectURLPatterns(extension, &new_patterns); if (!new_patterns.empty()) { - AppendNewURLPatterns(browser_context, new_patterns); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&UserScriptListener::AppendNewURLPatterns, this, + browser_context, new_patterns)); } } @@ -271,7 +280,10 @@ if (it->get() != extension) CollectURLPatterns(it->get(), &new_patterns); } - ReplaceURLPatterns(browser_context, new_patterns); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&UserScriptListener::ReplaceURLPatterns, this, + browser_context, new_patterns)); } void UserScriptListener::OnShutdown(ExtensionRegistry* registry) {
diff --git a/chrome/browser/extensions/user_script_listener.h b/chrome/browser/extensions/user_script_listener.h index c8207ab..1a26db1 100644 --- a/chrome/browser/extensions/user_script_listener.h +++ b/chrome/browser/extensions/user_script_listener.h
@@ -11,19 +11,20 @@ #include "base/compiler_specific.h" #include "base/containers/circular_deque.h" #include "base/macros.h" +#include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observer.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/common/resource_type.h" #include "extensions/browser/extension_registry_observer.h" class GURL; class URLPattern; namespace content { -class BrowserContext; -class NavigationHandle; -class NavigationThrottle; +class ResourceThrottle; } namespace extensions { @@ -34,24 +35,33 @@ // script, and if so, whether that user script is ready; if not, we delay the // request. // -// This class lives on the UI thread. -class UserScriptListener : public content::NotificationObserver, +// This class lives mostly on the IO thread. It listens on the UI thread for +// updates to loaded extensions. +class UserScriptListener : public base::RefCountedThreadSafe< + UserScriptListener, + content::BrowserThread::DeleteOnUIThread>, + public content::NotificationObserver, public ExtensionRegistryObserver { public: UserScriptListener(); - ~UserScriptListener() override; - // Constructs a NavigationThrottle if the UserScriptListener needs to delay - // the given navigation. Otherwise, this method returns NULL. - std::unique_ptr<content::NavigationThrottle> CreateNavigationThrottle( - content::NavigationHandle* navigation_handle); - - void SetUserScriptsNotReadyForTesting(content::BrowserContext* context); + // Constructs a ResourceThrottle if the UserScriptListener needs to delay the + // given URL. Otherwise, this method returns NULL. + content::ResourceThrottle* CreateResourceThrottle( + const GURL& url, + content::ResourceType resource_type); private: - using URLPatterns = std::list<URLPattern>; + friend struct content::BrowserThread::DeleteOnThread< + content::BrowserThread::UI>; + friend class base::DeleteHelper<UserScriptListener>; - bool ShouldDelayRequest(const GURL& url); + typedef std::list<URLPattern> URLPatterns; + + ~UserScriptListener() override; + + bool ShouldDelayRequest(const GURL& url, + content::ResourceType resource_type); void StartDelayedRequests(); // Update user_scripts_ready_ based on the status of all profiles. On a @@ -59,23 +69,21 @@ void CheckIfAllUserScriptsReady(); // Resume any requests that we delayed in order to wait for user scripts. - void UserScriptsReady(content::BrowserContext* context); + void UserScriptsReady(void* profile_id); // Clean up per-profile information related to the given profile. - void ProfileDestroyed(content::BrowserContext* context); + void ProfileDestroyed(void* profile_id); // Appends new url patterns to our list, also setting user_scripts_ready_ // to false. - void AppendNewURLPatterns(content::BrowserContext* context, - const URLPatterns& new_patterns); + void AppendNewURLPatterns(void* profile_id, const URLPatterns& new_patterns); // Replaces our url pattern list. This is only used when patterns have been // deleted, so user_scripts_ready_ remains unchanged. - void ReplaceURLPatterns(content::BrowserContext* context, - const URLPatterns& patterns); + void ReplaceURLPatterns(void* profile_id, const URLPatterns& patterns); // True if all user scripts from all profiles are ready. - bool user_scripts_ready_ = false; + bool user_scripts_ready_; // Stores a throttle per URL request that we have delayed. class Throttle; @@ -85,7 +93,7 @@ // Per-profile bookkeeping so we know when all user scripts are ready. struct ProfileData; - using ProfileDataMap = std::map<content::BrowserContext*, ProfileData>; + typedef std::map<void*, ProfileData> ProfileDataMap; ProfileDataMap profile_data_; // --- UI thread:
diff --git a/chrome/browser/extensions/user_script_listener_browsertest.cc b/chrome/browser/extensions/user_script_listener_browsertest.cc deleted file mode 100644 index 7fb616c..0000000 --- a/chrome/browser/extensions/user_script_listener_browsertest.cc +++ /dev/null
@@ -1,73 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/extensions/user_script_listener.h" -#include "chrome/test/base/testing_profile.h" -#include "chrome/test/base/ui_test_utils.h" -#include "content/public/browser/navigation_handle.h" -#include "content/public/browser/notification_service.h" -#include "content/public/test/test_navigation_observer.h" -#include "extensions/browser/notification_types.h" - -namespace extensions { -namespace { - -// Observer to wait for navigation start and ensure it is deferred. -class DidStartNavigationObserver : public content::WebContentsObserver { - public: - explicit DidStartNavigationObserver(content::WebContents* web_contents) - : content::WebContentsObserver(web_contents) {} - - void ExpectNavigationDeferredAfterStart() { - run_loop_.Run(); - EXPECT_TRUE(handle_); - EXPECT_TRUE(handle_->IsDeferredForTesting()); - } - - private: - // WebContentsObserver implementation: - void DidStartNavigation(content::NavigationHandle* handle) override { - handle_ = handle; - run_loop_.Quit(); - } - - content::NavigationHandle* handle_ = nullptr; - base::RunLoop run_loop_; -}; - -} // namespace - -using UserScriptListenerTest = ExtensionBrowserTest; - -// Test that navigations block while waiting for content scripts to load. -IN_PROC_BROWSER_TEST_F(UserScriptListenerTest, - NavigationWaitsForContentScriptsToLoad) { - ASSERT_TRUE(embedded_test_server()->Start()); - - TestingProfile profile; - ExtensionsBrowserClient::Get() - ->GetUserScriptListener() - ->SetUserScriptsNotReadyForTesting(&profile); - - content::WebContents* web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - content::TestNavigationObserver nav_observer(web_contents, 1); - DidStartNavigationObserver start_observer(web_contents); - - ui_test_utils::NavigateToURLWithDisposition( - browser(), embedded_test_server()->GetURL("/echo"), - WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); - - start_observer.ExpectNavigationDeferredAfterStart(); - - content::NotificationService::current()->Notify( - extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, - content::Source<Profile>(&profile), - content::NotificationService::NoDetails()); - - nav_observer.Wait(); -} - -} // namespace extensions
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index 523601be7..0182176 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -10,7 +10,6 @@ #include "base/files/file_util.h" #include "base/json/json_file_value_serializer.h" #include "base/macros.h" -#include "base/path_service.h" #include "base/run_loop.h" #include "base/threading/thread.h" #include "chrome/browser/chrome_notification_types.h" @@ -21,13 +20,18 @@ #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" -#include "content/public/browser/navigation_handle.h" -#include "content/public/browser/navigation_throttle.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/resource_throttle.h" #include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_utils.h" -#include "content/public/test/web_contents_tester.h" #include "extensions/browser/extension_registry.h" +#include "net/base/request_priority.h" +#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" +#include "net/url_request/url_request.h" +#include "net/url_request/url_request_filter.h" +#include "net/url_request/url_request_interceptor.h" +#include "net/url_request/url_request_test_job.h" +#include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_CHROMEOS) @@ -35,7 +39,7 @@ #include "components/user_manager/scoped_user_manager.h" #endif -using content::NavigationThrottle; +using content::ResourceThrottle; namespace extensions { @@ -43,6 +47,41 @@ const char kMatchingUrl[] = "http://google.com/"; const char kNotMatchingUrl[] = "http://example.com/"; +const char kTestData[] = "Hello, World!"; +const void* kUserDataKey = &kUserDataKey; + +class ThrottleDelegate : public base::SupportsUserData::Data, + public ResourceThrottle::Delegate { + public: + ThrottleDelegate(net::URLRequest* request, ResourceThrottle* throttle) + : request_(request), throttle_(throttle) { + throttle_->set_delegate_for_testing(this); + } + + // ResourceThrottle::Delegate implementation: + void Resume() override { request_->Start(); } + void Cancel() override { NOTREACHED(); } + void CancelWithError(int error_code) override { NOTREACHED(); } + + private: + net::URLRequest* request_; + std::unique_ptr<ResourceThrottle> throttle_; +}; + +// A simple test net::URLRequestJob. We don't care what it does, only that +// whether it starts and finishes. +class SimpleTestJob : public net::URLRequestTestJob { + public: + SimpleTestJob(net::URLRequest* request, + net::NetworkDelegate* network_delegate) + : net::URLRequestTestJob(request, + network_delegate, + test_headers(), + kTestData, + true) {} + private: + ~SimpleTestJob() override {} +}; // Yoinked from extension_manifest_unittest.cc. std::unique_ptr<base::DictionaryValue> LoadManifestFile( @@ -50,7 +89,7 @@ std::string* error) { EXPECT_TRUE(base::PathExists(path)); JSONFileValueDeserializer deserializer(path); - return base::DictionaryValue::From(deserializer.Deserialize(nullptr, error)); + return base::DictionaryValue::From(deserializer.Deserialize(NULL, error)); } scoped_refptr<Extension> LoadExtension(const std::string& filename, @@ -63,11 +102,28 @@ AppendASCII(filename.c_str()); std::unique_ptr<base::DictionaryValue> value = LoadManifestFile(path, error); if (!value) - return nullptr; + return NULL; return Extension::Create(path.DirName(), Manifest::UNPACKED, *value, Extension::NO_FLAGS, error); } +class SimpleTestJobURLRequestInterceptor + : public net::URLRequestInterceptor { + public: + SimpleTestJobURLRequestInterceptor() {} + ~SimpleTestJobURLRequestInterceptor() override {} + + // net::URLRequestJobFactory::ProtocolHandler + net::URLRequestJob* MaybeInterceptRequest( + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const override { + return new SimpleTestJob(request, network_delegate); + } + + private: + DISALLOW_COPY_AND_ASSIGN(SimpleTestJobURLRequestInterceptor); +}; + } // namespace class UserScriptListenerTest : public testing::Test { @@ -75,7 +131,23 @@ UserScriptListenerTest() : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), profile_manager_( - new TestingProfileManager(TestingBrowserProcess::GetGlobal())) {} + new TestingProfileManager(TestingBrowserProcess::GetGlobal())), + profile_(nullptr), + service_(nullptr) { + net::URLRequestFilter::GetInstance()->AddHostnameInterceptor( + "http", "google.com", std::unique_ptr<net::URLRequestInterceptor>( + new SimpleTestJobURLRequestInterceptor())); + net::URLRequestFilter::GetInstance()->AddHostnameInterceptor( + "http", "example.com", std::unique_ptr<net::URLRequestInterceptor>( + new SimpleTestJobURLRequestInterceptor())); + } + + ~UserScriptListenerTest() override { + net::URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", + "google.com"); + net::URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", + "example.com"); + } void SetUp() override { #if defined(OS_CHROMEOS) @@ -85,26 +157,43 @@ ASSERT_TRUE(profile_manager_->SetUp()); profile_ = profile_manager_->CreateTestingProfile("test-profile"); ASSERT_TRUE(profile_); + TestExtensionSystem* test_extension_system = static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile_)); service_ = test_extension_system->CreateExtensionService( base::CommandLine::ForCurrentProcess(), base::FilePath(), false); - web_contents_ = content::WebContentsTester::CreateTestWebContents( - profile_, content::SiteInstance::Create(profile_)); + listener_ = new UserScriptListener(); + } + + void TearDown() override { + listener_ = NULL; } protected: - NavigationThrottle::ThrottleCheckResult StartTestRequest( - const std::string& url_string) { - handle_ = content::NavigationHandle::CreateNavigationHandleForTesting( - GURL(url_string), web_contents_->GetMainFrame()); + std::unique_ptr<net::URLRequest> StartTestRequest( + net::URLRequest::Delegate* delegate, + const std::string& url_string, + net::TestURLRequestContext* context) { + GURL url(url_string); + std::unique_ptr<net::URLRequest> request(context->CreateRequest( + url, net::DEFAULT_PRIORITY, delegate, TRAFFIC_ANNOTATION_FOR_TESTS)); - std::unique_ptr<NavigationThrottle> throttle = - listener_.CreateNavigationThrottle(handle_.get()); - if (throttle) - handle_->RegisterThrottleForTesting(std::move(throttle)); - return handle_->CallWillStartRequestForTesting(); + ResourceThrottle* throttle = listener_->CreateResourceThrottle( + url, content::RESOURCE_TYPE_MAIN_FRAME); + + bool defer = false; + if (throttle) { + request->SetUserData(kUserDataKey, std::make_unique<ThrottleDelegate>( + request.get(), throttle)); + + throttle->WillStartRequest(&defer); + } + + if (!defer) + request->Start(); + + return request; } void LoadTestExtension() { @@ -130,11 +219,9 @@ content::TestBrowserThreadBundle thread_bundle_; std::unique_ptr<TestingProfileManager> profile_manager_; - UserScriptListener listener_; - TestingProfile* profile_ = nullptr; - ExtensionService* service_ = nullptr; - std::unique_ptr<content::WebContents> web_contents_; - std::unique_ptr<content::NavigationHandle> handle_; + scoped_refptr<UserScriptListener> listener_; + TestingProfile* profile_; + ExtensionService* service_; #if defined(OS_CHROMEOS) std::unique_ptr<user_manager::ScopedUserManager> user_manager_enabler_; #endif @@ -145,46 +232,70 @@ TEST_F(UserScriptListenerTest, DelayAndUpdate) { LoadTestExtension(); - EXPECT_EQ(NavigationThrottle::DEFER, StartTestRequest(kMatchingUrl)); + net::TestDelegate delegate; + net::TestURLRequestContext context; + std::unique_ptr<net::URLRequest> request( + StartTestRequest(&delegate, kMatchingUrl, &context)); + ASSERT_FALSE(request->is_pending()); content::NotificationService::current()->Notify( extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(profile_), content::NotificationService::NoDetails()); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(handle_->IsDeferredForTesting()); + EXPECT_EQ(kTestData, delegate.data_received()); } TEST_F(UserScriptListenerTest, DelayAndUnload) { LoadTestExtension(); - EXPECT_EQ(NavigationThrottle::DEFER, StartTestRequest(kMatchingUrl)); + net::TestDelegate delegate; + net::TestURLRequestContext context; + std::unique_ptr<net::URLRequest> request( + StartTestRequest(&delegate, kMatchingUrl, &context)); + ASSERT_FALSE(request->is_pending()); UnloadTestExtension(); base::RunLoop().RunUntilIdle(); // This is still not enough to start delayed requests. We have to notify the // listener that the user scripts have been updated. - EXPECT_TRUE(handle_->IsDeferredForTesting()); + ASSERT_FALSE(request->is_pending()); content::NotificationService::current()->Notify( extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(profile_), content::NotificationService::NoDetails()); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(handle_->IsDeferredForTesting()); + EXPECT_EQ(kTestData, delegate.data_received()); } TEST_F(UserScriptListenerTest, NoDelayNoExtension) { - EXPECT_EQ(NavigationThrottle::PROCEED, StartTestRequest(kMatchingUrl)); - EXPECT_FALSE(handle_->IsDeferredForTesting()); + net::TestDelegate delegate; + net::TestURLRequestContext context; + std::unique_ptr<net::URLRequest> request( + StartTestRequest(&delegate, kMatchingUrl, &context)); + + // The request should be started immediately. + ASSERT_TRUE(request->is_pending()); + + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(kTestData, delegate.data_received()); } TEST_F(UserScriptListenerTest, NoDelayNotMatching) { LoadTestExtension(); - EXPECT_EQ(NavigationThrottle::PROCEED, StartTestRequest(kNotMatchingUrl)); - EXPECT_FALSE(handle_->IsDeferredForTesting()); + net::TestDelegate delegate; + net::TestURLRequestContext context; + std::unique_ptr<net::URLRequest> request( + StartTestRequest(&delegate, kNotMatchingUrl, &context)); + + // The request should be started immediately. + ASSERT_TRUE(request->is_pending()); + + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(kTestData, delegate.data_received()); } TEST_F(UserScriptListenerTest, MultiProfile) { @@ -204,7 +315,11 @@ registry->AddEnabled(extension); registry->TriggerOnLoaded(extension.get()); - EXPECT_EQ(NavigationThrottle::DEFER, StartTestRequest(kMatchingUrl)); + net::TestDelegate delegate; + net::TestURLRequestContext context; + std::unique_ptr<net::URLRequest> request( + StartTestRequest(&delegate, kMatchingUrl, &context)); + ASSERT_FALSE(request->is_pending()); // When the first profile's user scripts are ready, the request should still // be blocked waiting for profile2. @@ -213,7 +328,8 @@ content::Source<Profile>(profile_), content::NotificationService::NoDetails()); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(handle_->IsDeferredForTesting()); + ASSERT_FALSE(request->is_pending()); + EXPECT_TRUE(delegate.data_received().empty()); // After profile2 is ready, the request should proceed. content::NotificationService::current()->Notify( @@ -221,7 +337,7 @@ content::Source<Profile>(profile2), content::NotificationService::NoDetails()); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(handle_->IsDeferredForTesting()); + EXPECT_EQ(kTestData, delegate.data_received()); } // Test when the script updated notification occurs before the throttle's @@ -229,12 +345,19 @@ // throttles. TEST_F(UserScriptListenerTest, ResumeBeforeStart) { LoadTestExtension(); - handle_ = content::NavigationHandle::CreateNavigationHandleForTesting( - GURL(kMatchingUrl), web_contents_->GetMainFrame()); + net::TestDelegate delegate; + net::TestURLRequestContext context; + GURL url(kMatchingUrl); + std::unique_ptr<net::URLRequest> request(context.CreateRequest( + url, net::DEFAULT_PRIORITY, &delegate, TRAFFIC_ANNOTATION_FOR_TESTS)); - std::unique_ptr<NavigationThrottle> throttle = - listener_.CreateNavigationThrottle(handle_.get()); + ResourceThrottle* throttle = + listener_->CreateResourceThrottle(url, content::RESOURCE_TYPE_MAIN_FRAME); ASSERT_TRUE(throttle); + request->SetUserData(kUserDataKey, std::make_unique<ThrottleDelegate>( + request.get(), throttle)); + + ASSERT_FALSE(request->is_pending()); content::NotificationService::current()->Notify( extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, @@ -242,7 +365,9 @@ content::NotificationService::NoDetails()); base::RunLoop().RunUntilIdle(); - ASSERT_EQ(content::NavigationThrottle::PROCEED, throttle->WillStartRequest()); + bool defer = false; + throttle->WillStartRequest(&defer); + ASSERT_FALSE(defer); } } // namespace
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index a0a2bcf..c8298c32 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc
@@ -295,7 +295,7 @@ ->GetFileSystemContext(); file_manager::util::ConvertSelectedFileInfoListToFileChooserFileInfoList( file_system_context, site_instance->GetSiteURL(), files, - base::Bind( + base::BindOnce( &FileSelectHelper::NotifyRenderFrameHostAndEndAfterConversion, this)); return;
diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc index f893686..fc68e36 100644 --- a/chrome/browser/infobars/infobars_browsertest.cc +++ b/chrome/browser/infobars/infobars_browsertest.cc
@@ -413,9 +413,9 @@ } case IBD::DATA_REDUCTION_PROXY_PREVIEW_INFOBAR_DELEGATE: - PreviewsInfoBarDelegate::Create( - GetWebContents(), previews::PreviewsType::LOFI, base::Time::Now(), - true, true, OnDismissPreviewsUICallback(), nullptr); + PreviewsInfoBarDelegate::Create(GetWebContents(), + previews::PreviewsType::LOFI, + base::Time::Now(), true, true, nullptr); break; case IBD::AUTOMATION_INFOBAR_DELEGATE:
diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc index 60905ec..5ee4566 100644 --- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc +++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
@@ -96,6 +96,7 @@ #if BUILDFLAG(ENABLE_EXTENSIONS) #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" +#include "chrome/browser/extensions/user_script_listener.h" #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" #include "extensions/common/extension_urls.h" #include "extensions/common/user_script.h" @@ -325,7 +326,13 @@ ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() : download_request_limiter_(g_browser_process->download_request_limiter()), - safe_browsing_(g_browser_process->safe_browsing_service()) {} + safe_browsing_(g_browser_process->safe_browsing_service()) +#if BUILDFLAG(ENABLE_EXTENSIONS) + , + user_script_listener_(new extensions::UserScriptListener()) +#endif +{ +} ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { #if BUILDFLAG(ENABLE_EXTENSIONS) @@ -473,6 +480,14 @@ if (first_throttle) throttles->push_back(base::WrapUnique(first_throttle)); +#if BUILDFLAG(ENABLE_EXTENSIONS) + content::ResourceThrottle* wait_for_extensions_init_throttle = + user_script_listener_->CreateResourceThrottle(request->url(), + resource_type); + if (wait_for_extensions_init_throttle) + throttles->push_back(base::WrapUnique(wait_for_extensions_init_throttle)); +#endif + const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); if (info->IsPrerendering()) { // TODO(jam): remove this throttle once http://crbug.com/740130 is fixed and
diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h index 72af8f7a..47ef7539 100644 --- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h +++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h
@@ -24,6 +24,10 @@ class NavigationData; } +namespace extensions { +class UserScriptListener; +} + namespace net { class URLRequest; } @@ -110,6 +114,7 @@ scoped_refptr<DownloadRequestLimiter> download_request_limiter_; scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_; #if BUILDFLAG(ENABLE_EXTENSIONS) + scoped_refptr<extensions::UserScriptListener> user_script_listener_; std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_; #endif
diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc index 732ccfd..6083bf5 100644 --- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc +++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
@@ -654,10 +654,6 @@ EmitDisplaysChangedMetric(); } -void ChromeBrowserMainExtraPartsMetrics::OnDisplayMetricsChanged( - const display::Display& display, - uint32_t changed_metrics) {} - void ChromeBrowserMainExtraPartsMetrics::EmitDisplaysChangedMetric() { int display_count = display::Screen::GetScreen()->GetNumDisplays(); if (display_count != display_count_) {
diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h index 521a883..cd8b0f9 100644 --- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h +++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h
@@ -45,8 +45,6 @@ // DisplayObserver overrides. void OnDisplayAdded(const display::Display& new_display) override; void OnDisplayRemoved(const display::Display& old_display) override; - void OnDisplayMetricsChanged(const display::Display& display, - uint32_t changed_metrics) override; // If the number of displays has changed, emit a UMA metric. void EmitDisplaysChangedMetric();
diff --git a/chrome/browser/notifications/win/mock_itoastnotifier.cc b/chrome/browser/notifications/win/mock_itoastnotifier.cc index 7847819..910c7da 100644 --- a/chrome/browser/notifications/win/mock_itoastnotifier.cc +++ b/chrome/browser/notifications/win/mock_itoastnotifier.cc
@@ -4,9 +4,6 @@ #include "chrome/browser/notifications/win/mock_itoastnotifier.h" -#include <wrl/client.h> - -#include "chrome/browser/notifications/notification_platform_bridge_win.h" #include "chrome/browser/notifications/win/notification_launch_id.h" #include "chrome/browser/notifications/win/notification_util.h" @@ -21,36 +18,6 @@ notification_shown_callback_ = callback; } -HRESULT MockIToastNotifier::QueryInterface(REFIID riid, void** ppvObject) { - if (riid == ABI::Windows::UI::Notifications::IID_IToastNotifier) { - AddRef(); - *ppvObject = static_cast<IToastNotifier*>(this); - return S_OK; - } - - return E_NOINTERFACE; -} - -ULONG MockIToastNotifier::AddRef() { - return ++refcount_; -} - -ULONG MockIToastNotifier::Release() { - return --refcount_; -} - -HRESULT MockIToastNotifier::GetIids(ULONG* iidCount, IID** iids) { - return E_NOTIMPL; -} - -HRESULT MockIToastNotifier::GetRuntimeClassName(HSTRING* className) { - return E_NOTIMPL; -} - -HRESULT MockIToastNotifier::GetTrustLevel(TrustLevel* trustLevel) { - return E_NOTIMPL; -} - HRESULT MockIToastNotifier::Show( winui::Notifications::IToastNotification* notification) { NotificationLaunchId launch_id = GetNotificationLaunchId(notification);
diff --git a/chrome/browser/notifications/win/mock_itoastnotifier.h b/chrome/browser/notifications/win/mock_itoastnotifier.h index a808830..e365332 100644 --- a/chrome/browser/notifications/win/mock_itoastnotifier.h +++ b/chrome/browser/notifications/win/mock_itoastnotifier.h
@@ -7,31 +7,27 @@ #include <windows.ui.notifications.h> +#include <wrl/implements.h> + #include "base/callback.h" #include "base/macros.h" class NotificationLaunchId; class MockIToastNotifier - : public ABI::Windows::UI::Notifications::IToastNotifier { + : public Microsoft::WRL::RuntimeClass< + Microsoft::WRL::RuntimeClassFlags< + Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>, + ABI::Windows::UI::Notifications::IToastNotifier> { public: MockIToastNotifier(); - ~MockIToastNotifier(); + ~MockIToastNotifier() override; // Sets a callback to be notified when Show has been called. void SetNotificationShownCallback( const base::RepeatingCallback< void(const NotificationLaunchId& launch_id)>& callback); - // IInspectable implementation: - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, - void** ppvObject) override; - ULONG STDMETHODCALLTYPE AddRef() override; - ULONG STDMETHODCALLTYPE Release() override; - HRESULT STDMETHODCALLTYPE GetIids(ULONG* iidCount, IID** iids) override; - HRESULT STDMETHODCALLTYPE GetRuntimeClassName(HSTRING* className) override; - HRESULT STDMETHODCALLTYPE GetTrustLevel(TrustLevel* trustLevel) override; - // ABI::Windows::UI::Notifications::IToastNotifier implementation: HRESULT STDMETHODCALLTYPE Show(ABI::Windows::UI::Notifications::IToastNotification* notification) @@ -57,8 +53,6 @@ scheduledToasts) override; private: - int refcount_ = 0; - base::RepeatingCallback<void(const NotificationLaunchId& launch_id)> notification_shown_callback_;
diff --git a/chrome/browser/offline_pages/android/evaluation/offline_page_evaluation_bridge.cc b/chrome/browser/offline_pages/android/evaluation/offline_page_evaluation_bridge.cc index f247439..f4604f0 100644 --- a/chrome/browser/offline_pages/android/evaluation/offline_page_evaluation_bridge.cc +++ b/chrome/browser/offline_pages/android/evaluation/offline_page_evaluation_bridge.cc
@@ -31,7 +31,6 @@ #include "components/offline_pages/core/background/request_notifier.h" #include "components/offline_pages/core/background/request_queue.h" #include "components/offline_pages/core/background/request_queue_store.h" -#include "components/offline_pages/core/background/request_queue_store_sql.h" #include "components/offline_pages/core/background/save_page_request.h" #include "components/offline_pages/core/downloads/download_notifying_observer.h" #include "components/offline_pages/core/offline_page_item.h" @@ -147,8 +146,8 @@ base::FilePath queue_store_path = profile->GetPath().Append(kTestRequestQueueDirname); - std::unique_ptr<RequestQueueStoreSQL> queue_store( - new RequestQueueStoreSQL(background_task_runner, queue_store_path)); + std::unique_ptr<RequestQueueStore> queue_store( + new RequestQueueStore(background_task_runner, queue_store_path)); std::unique_ptr<RequestQueue> queue(new RequestQueue(std::move(queue_store))); std::unique_ptr<android::EvaluationTestScheduler> scheduler( new android::EvaluationTestScheduler());
diff --git a/chrome/browser/offline_pages/android/request_coordinator_factory.cc b/chrome/browser/offline_pages/android/request_coordinator_factory.cc index eb9cebb..b9d26be 100644 --- a/chrome/browser/offline_pages/android/request_coordinator_factory.cc +++ b/chrome/browser/offline_pages/android/request_coordinator_factory.cc
@@ -23,7 +23,6 @@ #include "components/offline_pages/core/background/request_coordinator.h" #include "components/offline_pages/core/background/request_queue.h" #include "components/offline_pages/core/background/request_queue_store.h" -#include "components/offline_pages/core/background/request_queue_store_sql.h" #include "components/offline_pages/core/background/scheduler.h" #include "components/offline_pages/core/offline_page_feature.h" #include "components/offline_pages/core/offline_pages_ukm_reporter.h" @@ -72,8 +71,8 @@ base::FilePath queue_store_path = profile->GetPath().Append(chrome::kOfflinePageRequestQueueDirname); - std::unique_ptr<RequestQueueStoreSQL> queue_store( - new RequestQueueStoreSQL(background_task_runner, queue_store_path)); + std::unique_ptr<RequestQueueStore> queue_store( + new RequestQueueStore(background_task_runner, queue_store_path)); std::unique_ptr<RequestQueue> queue(new RequestQueue(std::move(queue_store))); std::unique_ptr<Scheduler> scheduler(new android::BackgroundSchedulerBridge());
diff --git a/chrome/browser/offline_pages/background_loader_offliner_unittest.cc b/chrome/browser/offline_pages/background_loader_offliner_unittest.cc index b6a43ad..93e3a6b 100644 --- a/chrome/browser/offline_pages/background_loader_offliner_unittest.cc +++ b/chrome/browser/offline_pages/background_loader_offliner_unittest.cc
@@ -404,6 +404,7 @@ PumpLoop(); offliner()->OnNetworkBytesChanged(15LL); EXPECT_TRUE(cancel_callback_called()); + EXPECT_FALSE(completion_callback_called()); EXPECT_FALSE(offliner()->is_loading()); // Offliner reset. EXPECT_EQ(progress(), 0LL); // network bytes not recorded when not busy. }
diff --git a/chrome/browser/offline_pages/test_request_coordinator_builder.cc b/chrome/browser/offline_pages/test_request_coordinator_builder.cc index e76f49e..d339781 100644 --- a/chrome/browser/offline_pages/test_request_coordinator_builder.cc +++ b/chrome/browser/offline_pages/test_request_coordinator_builder.cc
@@ -11,8 +11,9 @@ #include "components/offline_pages/core/background/offliner_stub.h" #include "components/offline_pages/core/background/request_coordinator.h" #include "components/offline_pages/core/background/request_queue.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" #include "components/offline_pages/core/background/scheduler_stub.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "components/offline_pages/core/offline_pages_ukm_reporter_stub.h" #include "content/public/browser/browser_context.h" @@ -23,11 +24,9 @@ // Use original policy. std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); - // Use the in-memory store. - std::unique_ptr<RequestQueueInMemoryStore> store( - new RequestQueueInMemoryStore()); // Use the regular test queue (should work). - std::unique_ptr<RequestQueue> queue(new RequestQueue(std::move(store))); + std::unique_ptr<RequestQueue> queue( + new RequestQueue(std::make_unique<TestRequestQueueStore>())); // Initialize the rest with stubs. std::unique_ptr<Offliner> offliner(new OfflinerStub());
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc index a62313e..d53e1e03 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc +++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
@@ -1900,3 +1900,64 @@ histogram_tester_.ExpectTotalCount( internal::kHistogramInputToFirstContentfulPaint, 1); } + +IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, + InputEventsForJavaScriptHref) { + embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data"); + content::SetupCrossSiteRedirector(embedded_test_server()); + ASSERT_TRUE(embedded_test_server()->Start()); + + auto waiter = CreatePageLoadMetricsTestWaiter(); + waiter->AddPageExpectation(TimingField::kLoadEvent); + waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); + ui_test_utils::NavigateToURL(browser(), + embedded_test_server()->GetURL( + "/page_load_metrics/javascript_href.html")); + waiter->Wait(); + waiter = CreatePageLoadMetricsTestWaiter(); + content::SimulateMouseClickAt( + browser()->tab_strip_model()->GetActiveWebContents(), 0, + blink::WebMouseEvent::Button::kLeft, gfx::Point(100, 100)); + waiter->AddPageExpectation(TimingField::kLoadEvent); + waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); + waiter->Wait(); + + histogram_tester_.ExpectTotalCount(internal::kHistogramInputToNavigation, 1); + histogram_tester_.ExpectTotalCount( + internal::kHistogramInputToNavigationLinkClick, 1); + histogram_tester_.ExpectTotalCount(internal::kHistogramInputToFirstPaint, 1); + histogram_tester_.ExpectTotalCount( + internal::kHistogramInputToFirstContentfulPaint, 1); +} + +IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, + InputEventsForJavaScriptWindowOpen) { + embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data"); + content::SetupCrossSiteRedirector(embedded_test_server()); + ASSERT_TRUE(embedded_test_server()->Start()); + + auto waiter = CreatePageLoadMetricsTestWaiter(); + waiter->AddPageExpectation(TimingField::kLoadEvent); + waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); + ui_test_utils::NavigateToURL( + browser(), embedded_test_server()->GetURL( + "/page_load_metrics/javascript_window_open.html")); + waiter->Wait(); + content::WebContentsAddedObserver web_contents_added_observer; + content::SimulateMouseClickAt( + browser()->tab_strip_model()->GetActiveWebContents(), 0, + blink::WebMouseEvent::Button::kLeft, gfx::Point(100, 100)); + // Wait for new window to open. + auto* web_contents = web_contents_added_observer.GetWebContents(); + waiter = std::make_unique<PageLoadMetricsTestWaiter>(web_contents); + waiter->AddPageExpectation(TimingField::kLoadEvent); + waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); + waiter->Wait(); + + histogram_tester_.ExpectTotalCount(internal::kHistogramInputToNavigation, 1); + histogram_tester_.ExpectTotalCount( + internal::kHistogramInputToNavigationLinkClick, 1); + histogram_tester_.ExpectTotalCount(internal::kHistogramInputToFirstPaint, 1); + histogram_tester_.ExpectTotalCount( + internal::kHistogramInputToFirstContentfulPaint, 1); +}
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 085aff5..44da71d5 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -893,6 +893,9 @@ { key::kCoalesceH2ConnectionsWithClientCertificatesForHosts, prefs::kH2ClientCertCoalescingHosts, base::Value::Type::LIST }, + { key::kEnterpriseHardwarePlatformAPIEnabled, + prefs::kEnterpriseHardwarePlatformAPIEnabled, + base::Value::Type::BOOLEAN }, }; // clang-format on
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index 7cc76ff..05bb7b7 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc
@@ -462,7 +462,7 @@ on_close_web_contents_deleters_.push_back( std::make_unique<OnCloseWebContentsDeleter>( this, std::move(old_web_contents))); - old_web_contents_ptr->DispatchBeforeUnload(); + old_web_contents_ptr->DispatchBeforeUnload(false /* auto_cancel */); } else { // No unload handler to run, so delete asap. ScheduleDeleteOldWebContents(std::move(old_web_contents), nullptr);
diff --git a/chrome/browser/previews/android/previews_android_bridge.cc b/chrome/browser/previews/android/previews_android_bridge.cc index 35fa1142..9f6c4e36 100644 --- a/chrome/browser/previews/android/previews_android_bridge.cc +++ b/chrome/browser/previews/android/previews_android_bridge.cc
@@ -40,3 +40,34 @@ return tab_helper->should_display_android_omnibox_badge(); } + +base::android::ScopedJavaLocalRef<jstring> +PreviewsAndroidBridge::GetOriginalHost( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, + const base::android::JavaParamRef<jobject>& j_web_contents) { + content::WebContents* web_contents = + content::WebContents::FromJavaWebContents(j_web_contents); + if (!web_contents) + return base::android::ScopedJavaLocalRef<jstring>(); + return base::android::ScopedJavaLocalRef<jstring>( + base::android::ConvertUTF8ToJavaString( + env, web_contents->GetVisibleURL().host())); +} + +void PreviewsAndroidBridge::LoadOriginal( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, + const base::android::JavaParamRef<jobject>& j_web_contents) { + content::WebContents* web_contents = + content::WebContents::FromJavaWebContents(j_web_contents); + if (!web_contents) + return; + + PreviewsUITabHelper* tab_helper = + PreviewsUITabHelper::FromWebContents(web_contents); + if (!tab_helper) + return; + + tab_helper->ReloadWithoutPreviews(); +}
diff --git a/chrome/browser/previews/android/previews_android_bridge.h b/chrome/browser/previews/android/previews_android_bridge.h index 480f8057..d4893f6 100644 --- a/chrome/browser/previews/android/previews_android_bridge.h +++ b/chrome/browser/previews/android/previews_android_bridge.h
@@ -23,6 +23,15 @@ const base::android::JavaParamRef<jobject>& obj, const base::android::JavaParamRef<jobject>& j_web_contents); + base::android::ScopedJavaLocalRef<jstring> GetOriginalHost( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, + const base::android::JavaParamRef<jobject>& j_web_contents); + + void LoadOriginal(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, + const base::android::JavaParamRef<jobject>& j_web_contents); + private: base::WeakPtrFactory<PreviewsAndroidBridge> weak_factory_;
diff --git a/chrome/browser/previews/previews_infobar_delegate.cc b/chrome/browser/previews/previews_infobar_delegate.cc index e305c38..abf3f52 100644 --- a/chrome/browser/previews/previews_infobar_delegate.cc +++ b/chrome/browser/previews/previews_infobar_delegate.cc
@@ -62,32 +62,6 @@ PreviewsInfoBarDelegate::TIMESTAMP_INDEX_BOUNDARY); } -// Reloads the content of the page without previews. -void ReloadWithoutPreviews(previews::PreviewsType previews_type, - content::WebContents* web_contents) { - switch (previews_type) { - case previews::PreviewsType::LITE_PAGE: - case previews::PreviewsType::LITE_PAGE_REDIRECT: - case previews::PreviewsType::OFFLINE: - case previews::PreviewsType::NOSCRIPT: - case previews::PreviewsType::RESOURCE_LOADING_HINTS: - // Previews may cause a redirect, so we should use the original URL. The - // black list prevents showing the preview again. - web_contents->GetController().Reload( - content::ReloadType::ORIGINAL_REQUEST_URL, true); - break; - case previews::PreviewsType::LOFI: - web_contents->ReloadLoFiImages(); - break; - case previews::PreviewsType::NONE: - case previews::PreviewsType::UNSPECIFIED: - case previews::PreviewsType::LAST: - case previews::PreviewsType::DEPRECATED_AMP_REDIRECTION: - NOTREACHED(); - break; - } -} - void InformPLMOfOptOut(content::WebContents* web_contents) { page_load_metrics::MetricsWebContentsObserver* metrics_web_contents_observer = page_load_metrics::MetricsWebContentsObserver::FromWebContents( @@ -102,9 +76,6 @@ } // namespace PreviewsInfoBarDelegate::~PreviewsInfoBarDelegate() { - if (!on_dismiss_callback_.is_null()) - std::move(on_dismiss_callback_).Run(false); - RecordPreviewsInfoBarAction(previews_type_, infobar_dismissed_action_); } @@ -115,7 +86,6 @@ base::Time previews_freshness, bool is_data_saver_user, bool is_reload, - OnDismissPreviewsUICallback on_dismiss_callback, previews::PreviewsUIService* previews_ui_service) { PreviewsUITabHelper* ui_tab_helper = PreviewsUITabHelper::FromWebContents(web_contents); @@ -131,7 +101,7 @@ std::unique_ptr<PreviewsInfoBarDelegate> delegate(new PreviewsInfoBarDelegate( ui_tab_helper, previews_type, previews_freshness, is_data_saver_user, - is_reload, std::move(on_dismiss_callback))); + is_reload)); #if defined(OS_ANDROID) std::unique_ptr<infobars::InfoBar> infobar_ptr( @@ -166,8 +136,7 @@ previews::PreviewsType previews_type, base::Time previews_freshness, bool is_data_saver_user, - bool is_reload, - OnDismissPreviewsUICallback on_dismiss_callback) + bool is_reload) : ConfirmInfoBarDelegate(), ui_tab_helper_(ui_tab_helper), previews_type_(previews_type), @@ -176,8 +145,7 @@ infobar_dismissed_action_(INFOBAR_DISMISSED_BY_TAB_CLOSURE), message_text_(l10n_util::GetStringUTF16( is_data_saver_user ? IDS_PREVIEWS_INFOBAR_SAVED_DATA_TITLE - : IDS_PREVIEWS_INFOBAR_FASTER_PAGE_TITLE)), - on_dismiss_callback_(std::move(on_dismiss_callback)) { + : IDS_PREVIEWS_INFOBAR_FASTER_PAGE_TITLE)) { DCHECK(previews_type_ != previews::PreviewsType::NONE && previews_type_ != previews::PreviewsType::UNSPECIFIED); } @@ -234,15 +202,13 @@ bool PreviewsInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { infobar_dismissed_action_ = INFOBAR_LOAD_ORIGINAL_CLICKED; - if (!on_dismiss_callback_.is_null()) - std::move(on_dismiss_callback_).Run(true); content::WebContents* web_contents = InfoBarService::WebContentsFromInfoBar(infobar()); InformPLMOfOptOut(web_contents); - ReloadWithoutPreviews(previews_type_, web_contents); + ui_tab_helper_->ReloadWithoutPreviews(previews_type_); return true; }
diff --git a/chrome/browser/previews/previews_infobar_delegate.h b/chrome/browser/previews/previews_infobar_delegate.h index 23f40fb..b190542f 100644 --- a/chrome/browser/previews/previews_infobar_delegate.h +++ b/chrome/browser/previews/previews_infobar_delegate.h
@@ -61,7 +61,6 @@ base::Time previews_freshness, bool is_data_saver_user, bool is_reload, - OnDismissPreviewsUICallback on_dismiss_callback, previews::PreviewsUIService* previews_ui_service); // ConfirmInfoBarDelegate overrides: @@ -79,8 +78,7 @@ previews::PreviewsType previews_type, base::Time previews_freshness, bool is_data_saver_user, - bool is_reload, - OnDismissPreviewsUICallback on_dismiss_callback); + bool is_reload); // ConfirmInfoBarDelegate overrides: infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; @@ -99,8 +97,6 @@ const base::string16 message_text_; - OnDismissPreviewsUICallback on_dismiss_callback_; - DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); };
diff --git a/chrome/browser/previews/previews_infobar_delegate_unittest.cc b/chrome/browser/previews/previews_infobar_delegate_unittest.cc index b79f6667..5397bf8 100644 --- a/chrome/browser/previews/previews_infobar_delegate_unittest.cc +++ b/chrome/browser/previews/previews_infobar_delegate_unittest.cc
@@ -222,8 +222,6 @@ bool is_reload) { PreviewsInfoBarDelegate::Create( web_contents(), type, previews_freshness, is_data_saver_user, is_reload, - base::Bind(&PreviewsInfoBarDelegateUnitTest::OnDismissPreviewsInfobar, - base::Unretained(this)), previews_ui_service_.get()); EXPECT_EQ(1U, infobar_service()->infobar_count()); @@ -270,10 +268,6 @@ ->set_displayed_preview_ui(false); } - void OnDismissPreviewsInfobar(bool user_opt_out) { - user_opt_out_ = user_opt_out; - } - InfoBarService* infobar_service() { return InfoBarService::FromWebContents(web_contents()); } @@ -293,7 +287,6 @@ std::unique_ptr<data_reduction_proxy::DataReductionProxyTestContext> drp_test_context_; - base::Optional<bool> user_opt_out_; std::unique_ptr<base::FieldTrialList> field_trial_list_; base::test::ScopedFeatureList scoped_feature_list_; std::unique_ptr<base::HistogramTester> tester_; @@ -320,14 +313,12 @@ PreviewsInfoBarDelegate::Create( web_contents(), previews::PreviewsType::LOFI, base::Time() /* previews_freshness */, true /* is_data_saver_user */, - false /* is_reload */, OnDismissPreviewsUICallback(), - previews_ui_service_.get()); + false /* is_reload */, previews_ui_service_.get()); EXPECT_EQ(1U, infobar_service()->infobar_count()); // Navigate and make sure the infobar is dismissed. NavigateAndCommit(GURL(kTestUrl)); EXPECT_EQ(0U, infobar_service()->infobar_count()); - EXPECT_FALSE(user_opt_out_.value()); tester_->ExpectBucketCount( kUMAPreviewsInfoBarActionLoFi, @@ -347,15 +338,13 @@ PreviewsInfoBarDelegate::Create( web_contents(), previews::PreviewsType::LOFI, base::Time() /* previews_freshness */, true /* is_data_saver_user */, - false /* is_reload */, OnDismissPreviewsUICallback(), - previews_ui_service_.get()); + false /* is_reload */, previews_ui_service_.get()); EXPECT_EQ(1U, infobar_service()->infobar_count()); // Navigate to test URL as a reload to dismiss the infobar. content::NavigationSimulator::Reload(web_contents()); EXPECT_EQ(0U, infobar_service()->infobar_count()); - EXPECT_FALSE(user_opt_out_.value()); tester_->ExpectBucketCount( kUMAPreviewsInfoBarActionLoFi, @@ -378,7 +367,6 @@ tester_->ExpectBucketCount(kUMAPreviewsInfoBarActionLoFi, PreviewsInfoBarDelegate::INFOBAR_DISMISSED_BY_USER, 1); - EXPECT_FALSE(user_opt_out_.value()); } TEST_F(PreviewsInfoBarDelegateUnitTest, @@ -393,7 +381,6 @@ tester_->ExpectBucketCount( kUMAPreviewsInfoBarActionLoFi, PreviewsInfoBarDelegate::INFOBAR_DISMISSED_BY_TAB_CLOSURE, 1); - EXPECT_FALSE(user_opt_out_.value()); } TEST_F(PreviewsInfoBarDelegateUnitTest, @@ -428,7 +415,6 @@ tester_->ExpectBucketCount( kUMAPreviewsInfoBarActionLoFi, PreviewsInfoBarDelegate::INFOBAR_LOAD_ORIGINAL_CLICKED, 1); - EXPECT_TRUE(user_opt_out_.value()); EXPECT_TRUE(opt_out_called_); } @@ -476,8 +462,7 @@ PreviewsInfoBarDelegate::Create( web_contents(), previews::PreviewsType::LOFI, base::Time() /* previews_freshness */, true /* is_data_saver_user */, - false /* is_reload */, OnDismissPreviewsUICallback(), - previews_ui_service_.get()); + false /* is_reload */, previews_ui_service_.get()); // Infobar should not be shown again since a navigation hasn't happened. EXPECT_EQ(0U, infobar_service()->infobar_count());
diff --git a/chrome/browser/previews/previews_lite_page_browsertest.cc b/chrome/browser/previews/previews_lite_page_browsertest.cc index cf70027..b309a48 100644 --- a/chrome/browser/previews/previews_lite_page_browsertest.cc +++ b/chrome/browser/previews/previews_lite_page_browsertest.cc
@@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/metrics/field_trial_param_associator.h" #include "base/metrics/field_trial_params.h" +#include "base/rand_util.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -102,6 +103,14 @@ base::Unretained(this))); ASSERT_TRUE(previews_server_->Start()); + // Set up the slow HTTP server with delayed resource handler. + slow_http_server_ = std::make_unique<net::EmbeddedTestServer>( + net::EmbeddedTestServer::TYPE_HTTP); + slow_http_server_->RegisterRequestHandler(base::BindRepeating( + &PreviewsLitePageServerBrowserTest::HandleSlowResourceRequest, + base::Unretained(this))); + ASSERT_TRUE(slow_http_server_->Start()); + std::unique_ptr<base::FeatureList> feature_list = std::make_unique<base::FeatureList>(); { @@ -111,7 +120,8 @@ std::map<std::string, std::string> feature_parameters = { {"previews_host", previews_server().spec()}, {"blacklisted_path_suffixes", ".mp4,.jpg"}, - {"trigger_on_localhost", "true"}}; + {"trigger_on_localhost", "true"}, + {"navigation_timeout_milliseconds", "2000"}}; base::FieldTrialParamAssociator::GetInstance()->AssociateFieldTrialParams( "TrialName1", "GroupName1", feature_parameters); @@ -168,6 +178,10 @@ content::NavigationEntry* entry = GetWebContents()->GetController().GetVisibleEntry(); EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); + + // Clear the decider's single bypass map so that future page loads aren't + // bypassed for the wrong reason. + ClearSingleBypass(); } void VerifyErrorPageLoaded() const { @@ -183,9 +197,16 @@ } // Returns a HTTP URL that will respond with the given HTTP response code and - // headers when used by the previews server. - GURL HttpLitePageURL(int return_code, std::string* headers = nullptr) const { - std::string query = "resp=" + base::IntToString(return_code); + // headers when used by the previews server. The response can be delayed a + // number of milliseconds by passing a value > 0 for |delay_ms| or pass -1 to + // make the response hang indefinitely. + GURL HttpLitePageURL(int return_code, + std::string* headers = nullptr, + int delay_ms = 0) const { + std::string query = "resp=" + base::IntToString(return_code) + "&rand=" + + base::IntToString(base::RandInt(INT_MIN, INT_MAX)); + if (delay_ms != 0) + query += "&delay_ms=" + base::IntToString(delay_ms); if (headers) query += "&headers=" + *headers; GURL::Replacements replacements; @@ -194,9 +215,16 @@ } // Returns a HTTPS URL that will respond with the given HTTP response code and - // headers when used by the previews server. - GURL HttpsLitePageURL(int return_code, std::string* headers = nullptr) const { - std::string query = "resp=" + base::IntToString(return_code); + // headers when used by the previews server. The response can be delayed a + // number of milliseconds by passing a value > 0 for |delay_ms| or pass -1 to + // make the response hang indefinitely. + GURL HttpsLitePageURL(int return_code, + std::string* headers = nullptr, + int delay_ms = 0) const { + std::string query = "resp=" + base::IntToString(return_code) + "&rand=" + + base::IntToString(base::RandInt(INT_MIN, INT_MAX)); + if (delay_ms != 0) + query += "&delay_ms=" + base::IntToString(delay_ms); if (headers) query += "&headers=" + *headers; GURL::Replacements replacements; @@ -204,6 +232,16 @@ return base_https_lite_page_url().ReplaceComponents(replacements); } + void ClearSingleBypass() const { + PreviewsService* previews_service = + PreviewsServiceFactory::GetForProfile(browser()->profile()); + ASSERT_TRUE(previews_service); + PreviewsLitePageDecider* decider = + previews_service->previews_lite_page_decider(); + ASSERT_TRUE(decider); + decider->ClearSingleBypassForTesting(); + } + virtual GURL previews_server() const { return previews_server_->base_url(); } const GURL& https_url() const { return https_url_; } @@ -212,6 +250,7 @@ } const GURL& https_media_url() const { return https_media_url_; } const GURL& http_url() const { return http_url_; } + const GURL& slow_http_url() const { return slow_http_server_->base_url(); } const GURL& base_http_lite_page_url() const { return base_http_lite_page_url_; } @@ -230,10 +269,20 @@ return std::move(response); } + std::unique_ptr<net::test_server::HttpResponse> HandleSlowResourceRequest( + const net::test_server::HttpRequest& request) { + std::unique_ptr<net::test_server::DelayedHttpResponse> response = + std::make_unique<net::test_server::DelayedHttpResponse>( + base::TimeDelta::FromSeconds(3)); + response->set_code(net::HttpStatusCode::HTTP_OK); + return std::move(response); + } + std::unique_ptr<net::test_server::HttpResponse> HandleResourceRequest( const net::test_server::HttpRequest& request) { std::unique_ptr<net::test_server::BasicHttpResponse> response = std::make_unique<net::test_server::BasicHttpResponse>(); + std::string original_url_str; // Ignore anything that's not a previews request with an unused status. @@ -262,6 +311,23 @@ return response; } + std::string delay_query_param; + int delay_ms = 0; + + // Determine whether to delay the preview response using the |original_url|. + if (net::GetValueForKeyInQuery(original_url, "delay_ms", + &delay_query_param)) { + base::StringToInt(delay_query_param, &delay_ms); + } + + if (delay_ms == -1) { + return std::make_unique<net::test_server::HungResponse>(); + } + if (delay_ms > 0) { + response = std::make_unique<net::test_server::DelayedHttpResponse>( + base::TimeDelta::FromMilliseconds(delay_ms)); + } + std::string code_query_param; int return_code = 0; if (net::GetValueForKeyInQuery(original_url, "resp", &code_query_param)) @@ -302,6 +368,7 @@ std::unique_ptr<net::EmbeddedTestServer> previews_server_; std::unique_ptr<net::EmbeddedTestServer> https_server_; std::unique_ptr<net::EmbeddedTestServer> http_server_; + std::unique_ptr<net::EmbeddedTestServer> slow_http_server_; GURL https_url_; GURL base_https_lite_page_url_; GURL https_media_url_; @@ -488,6 +555,37 @@ // See https://crbug.com/782322 for detail. // Also occasional flakes on win7 (https://crbug.com/789542). #if defined(OS_ANDROID) || defined(OS_LINUX) +#define MAYBE_LitePagePreviewsTimeout LitePagePreviewsTimeout +#else +#define MAYBE_LitePagePreviewsTimeout DISABLED_LitePagePreviewsTimeout +#endif +IN_PROC_BROWSER_TEST_F(PreviewsLitePageServerBrowserTest, + MAYBE_LitePagePreviewsTimeout) { + { + // Ensure that a hung previews navigation doesn't wind up at the previews + // server. + base::HistogramTester histogram_tester; + ui_test_utils::NavigateToURL(browser(), HttpsLitePageURL(200, nullptr, -1)); + VerifyPreviewNotLoaded(); + histogram_tester.ExpectBucketCount( + "Previews.ServerLitePage.ServerResponse", + PreviewsLitePageNavigationThrottle::ServerResponse::kTimeout, 1); + } + + { + // Ensure that a hung normal navigation eventually loads. + base::HistogramTester histogram_tester; + ui_test_utils::NavigateToURL(browser(), slow_http_url()); + VerifyPreviewNotLoaded(); + histogram_tester.ExpectTotalCount("Previews.ServerLitePage.ServerResponse", + 0); + } +} + +// Previews InfoBar (which these tests trigger) does not work on Mac. +// See https://crbug.com/782322 for detail. +// Also occasional flakes on win7 (https://crbug.com/789542). +#if defined(OS_ANDROID) || defined(OS_LINUX) #define MAYBE_LitePagePreviewsResponse LitePagePreviewsResponse #else #define MAYBE_LitePagePreviewsResponse DISABLED_LitePagePreviewsResponse
diff --git a/chrome/browser/previews/previews_lite_page_decider.cc b/chrome/browser/previews/previews_lite_page_decider.cc index e1d8e45..cec4c558 100644 --- a/chrome/browser/previews/previews_lite_page_decider.cc +++ b/chrome/browser/previews/previews_lite_page_decider.cc
@@ -87,6 +87,10 @@ clock_ = clock; } +void PreviewsLitePageDecider::ClearSingleBypassForTesting() { + single_bypass_.clear(); +} + void PreviewsLitePageDecider::SetServerUnavailableFor( base::TimeDelta retry_after) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chrome/browser/previews/previews_lite_page_decider.h b/chrome/browser/previews/previews_lite_page_decider.h index 2fec6c4..feca5277 100644 --- a/chrome/browser/previews/previews_lite_page_decider.h +++ b/chrome/browser/previews/previews_lite_page_decider.h
@@ -46,6 +46,9 @@ // Sets the internal clock for testing. void SetClockForTesting(const base::TickClock* clock); + // Clears all single bypasses for testing. + void ClearSingleBypassForTesting(); + private: FRIEND_TEST_ALL_PREFIXES(PreviewsLitePageDeciderTest, TestServerUnavailable); FRIEND_TEST_ALL_PREFIXES(PreviewsLitePageDeciderTest, TestSingleBypass);
diff --git a/chrome/browser/previews/previews_lite_page_navigation_throttle.cc b/chrome/browser/previews/previews_lite_page_navigation_throttle.cc index 75f38fe..4bdadb0 100644 --- a/chrome/browser/previews/previews_lite_page_navigation_throttle.cc +++ b/chrome/browser/previews/previews_lite_page_navigation_throttle.cc
@@ -5,8 +5,10 @@ #include "chrome/browser/previews/previews_lite_page_navigation_throttle.h" #include <string> +#include <unordered_set> #include <vector> +#include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_macros.h" #include "base/rand_util.h" @@ -25,6 +27,7 @@ #include "content/public/browser/navigation_handle.h" #include "content/public/browser/page_navigator.h" #include "content/public/browser/web_contents.h" +#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" #include "content/public/common/referrer.h" #include "crypto/sha2.h" @@ -81,10 +84,53 @@ } // namespace class WebContentsLifetimeHelper - : public content::WebContentsUserData<WebContentsLifetimeHelper> { + : public content::WebContentsObserver, + public content::WebContentsUserData<WebContentsLifetimeHelper> { public: explicit WebContentsLifetimeHelper(content::WebContents* web_contents) - : web_contents_(web_contents), weak_factory_(this) {} + : content::WebContentsObserver(web_contents), + web_contents_(web_contents), + weak_factory_(this) {} + + // Keep track of all ongoing navigations in this WebContents. + void DidStartNavigation(content::NavigationHandle* handle) override { + DCHECK(handle); + if (!handle->IsInMainFrame()) + return; + + navigations_.insert(handle); + } + + // Keep track of all ongoing navigations in this WebContents. + void DidFinishNavigation(content::NavigationHandle* handle) override { + DCHECK(handle); + if (!handle->IsInMainFrame()) + return; + + if (navigations_.find(handle) != navigations_.end()) { + navigations_.erase(handle); + } + } + + // This method should be called after some delay to cancel an ongoing previews + // navigation. This method checks if the ongoing navigation is for the given + // |url|, if so the |fallback_callback| is run. + void CheckForHungNavigation(const GURL& url, + base::OnceClosure fallback_callback) { + DCHECK_GE(2u, navigations_.size()); + if (navigations_.empty()) + return; + + content::NavigationHandle* handle = *navigations_.begin(); + if (handle->GetURL() != url) + return; + + UMA_HISTOGRAM_ENUMERATION( + "Previews.ServerLitePage.ServerResponse", + PreviewsLitePageNavigationThrottle::ServerResponse::kTimeout); + + std::move(fallback_callback).Run(); + } base::WeakPtr<WebContentsLifetimeHelper> GetWeakPtr() { return weak_factory_.GetWeakPtr(); @@ -99,6 +145,7 @@ private: content::WebContents* web_contents_; + std::unordered_set<content::NavigationHandle*> navigations_; base::WeakPtrFactory<WebContentsLifetimeHelper> weak_factory_; }; @@ -212,23 +259,30 @@ return GetPreviewsURLForURL(navigation_handle()->GetURL()); } -content::NavigationThrottle::ThrottleCheckResult -PreviewsLitePageNavigationThrottle::CreateNewNavigation( - content::OpenURLParams url_params) const { - // The helper class and its weak pointer protect against the WebContents - // dying in-between the PostTask and its execution, resulting in a use after - // free bug. Since the helper is a WebContentsUserData, it will be - // destroyed when the WebContents is and the task will not be executed. - content::WebContents* web_contents = navigation_handle()->GetWebContents(); +// static +void PreviewsLitePageNavigationThrottle::LoadAndBypass( + content::WebContents* web_contents, + PreviewsLitePageNavigationThrottleManager* manager, + const content::OpenURLParams& params, + bool use_post_task) { + DCHECK(web_contents); + DCHECK(manager); + + manager->AddSingleBypass(params.url.spec()); + WebContentsLifetimeHelper::CreateForWebContents(web_contents); WebContentsLifetimeHelper* helper = WebContentsLifetimeHelper::FromWebContents(web_contents); + + if (!use_post_task) { + helper->PostNewNavigation(params); + return; + } + content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::BindOnce(&WebContentsLifetimeHelper::PostNewNavigation, - helper->GetWeakPtr(), url_params)); - - return content::NavigationThrottle::CANCEL; + helper->GetWeakPtr(), params)); } content::NavigationThrottle::ThrottleCheckResult @@ -264,9 +318,40 @@ request_headers.SetHeader(kChromeProxyHeader, header_value); } - content::OpenURLParams url_params = MakeOpenURLParams( - navigation_handle(), GetPreviewsURL(), request_headers.ToString()); - return CreateNewNavigation(url_params); + content::WebContents* web_contents = navigation_handle()->GetWebContents(); + WebContentsLifetimeHelper::CreateForWebContents(web_contents); + WebContentsLifetimeHelper* helper = + WebContentsLifetimeHelper::FromWebContents(web_contents); + + // Post a delayed task to the WebContents helper. This task will check after a + // timeout whether the previews navigation has finished (either in success or + // failure). If not, the helper will stop the ongoing previews navigation and + // load the original page. + content::BrowserThread::PostDelayedTask( + content::BrowserThread::UI, FROM_HERE, + base::BindOnce( + &WebContentsLifetimeHelper::CheckForHungNavigation, + helper->GetWeakPtr(), GetPreviewsURL(), + base::BindOnce( + &PreviewsLitePageNavigationThrottle::LoadAndBypass, + base::Unretained(web_contents), manager_, + MakeOpenURLParams(navigation_handle(), + navigation_handle()->GetURL(), std::string()), + false)), + previews::params::LitePagePreviewsNavigationTimeoutDuration()); + + // The helper class and its weak pointer protect against the WebContents + // dying in-between the PostTask and its execution, resulting in a use after + // free crash. Since the helper is a WebContentsUserData, it will be + // destroyed when the WebContents is and the task will not be executed. + content::BrowserThread::PostTask( + content::BrowserThread::UI, FROM_HERE, + base::BindOnce(&WebContentsLifetimeHelper::PostNewNavigation, + helper->GetWeakPtr(), + MakeOpenURLParams(navigation_handle(), GetPreviewsURL(), + request_headers.ToString()))); + + return content::NavigationThrottle::CANCEL; } content::NavigationThrottle::ThrottleCheckResult @@ -302,11 +387,11 @@ // The Preview was triggered but there was some irrecoverable issue (like // there is no network connection). Load the original page and let it go // through the normal process for whatever error it is. - manager_->AddSingleBypass(original_url); - content::OpenURLParams url_params = - MakeOpenURLParams(navigation_handle(), GURL(original_url), std::string()); - - return CreateNewNavigation(url_params); + LoadAndBypass( + navigation_handle()->GetWebContents(), manager_, + MakeOpenURLParams(navigation_handle(), GURL(original_url), std::string()), + true); + return content::NavigationThrottle::CANCEL; } content::NavigationThrottle::ThrottleCheckResult @@ -345,17 +430,12 @@ base::TimeTicks::Now() - navigation_handle()->NavigationStart(); UMA_HISTOGRAM_MEDIUM_TIMES("Previews.ServerLitePage.HttpOnlyFallbackPenalty", penalty); - manager_->AddSingleBypass(original_url); - content::OpenURLParams original_url_params = - MakeOpenURLParams(navigation_handle(), GURL(original_url), std::string()); if (response_code == net::HTTP_NOT_FOUND) { UMA_HISTOGRAM_ENUMERATION("Previews.ServerLitePage.ServerResponse", ServerResponse::kPreviewUnavailable); - return CreateNewNavigation(original_url_params); - } - if (response_code == net::HTTP_SERVICE_UNAVAILABLE) { + } else if (response_code == net::HTTP_SERVICE_UNAVAILABLE) { std::string retry_after_header; base::TimeDelta retry_after = base::TimeDelta::FromSeconds( base::RandInt(60, previews::params::PreviewServerLoadshedMaxSeconds())); @@ -368,12 +448,16 @@ UMA_HISTOGRAM_ENUMERATION("Previews.ServerLitePage.ServerResponse", ServerResponse::kServiceUnavailable); - return CreateNewNavigation(original_url_params); + } else { + UMA_HISTOGRAM_ENUMERATION("Previews.ServerLitePage.ServerResponse", + ServerResponse::kOther); } - UMA_HISTOGRAM_ENUMERATION("Previews.ServerLitePage.ServerResponse", - ServerResponse::kOther); - return CreateNewNavigation(original_url_params); + LoadAndBypass( + navigation_handle()->GetWebContents(), manager_, + MakeOpenURLParams(navigation_handle(), GURL(original_url), std::string()), + true); + return content::NavigationThrottle::CANCEL; } const char* PreviewsLitePageNavigationThrottle::GetNameForLogging() {
diff --git a/chrome/browser/previews/previews_lite_page_navigation_throttle.h b/chrome/browser/previews/previews_lite_page_navigation_throttle.h index 4f26226c..1501fa1 100644 --- a/chrome/browser/previews/previews_lite_page_navigation_throttle.h +++ b/chrome/browser/previews/previews_lite_page_navigation_throttle.h
@@ -50,7 +50,8 @@ kServiceUnavailable = 3, kOther = 4, kFailed = 5, - kMaxValue = kFailed, + kTimeout = 6, + kMaxValue = kTimeout, }; PreviewsLitePageNavigationThrottle( @@ -67,6 +68,13 @@ // Returns the URL for a preview given by the url. static GURL GetPreviewsURLForURL(const GURL& original_url); + // Starts a new navigation with |params| page in the given |web_contents|, + // adding the params' url as a single bypass to |manager|. + static void LoadAndBypass(content::WebContents* web_contents, + PreviewsLitePageNavigationThrottleManager* manager, + const content::OpenURLParams& params, + bool use_post_task); + private: // The current effective connection type; net::EffectiveConnectionType GetECT() const; @@ -87,13 +95,6 @@ const; // Can be called by any of the content::NavigationThrottle implementation - // methods to create a new navigation with the give |content::OpenURLParams|. - // Returns the |content::NavigationThrottle::ThrottleCheckResult| for the - // implemented method to return. - content::NavigationThrottle::ThrottleCheckResult CreateNewNavigation( - content::OpenURLParams url_params) const; - - // Can be called by any of the content::NavigationThrottle implementation // methods to trigger the preview. Returns the // |content::NavigationThrottle::ThrottleCheckResult| for the implemented // method to return.
diff --git a/chrome/browser/previews/previews_ui_tab_helper.cc b/chrome/browser/previews/previews_ui_tab_helper.cc index 5616869..1f03027 100644 --- a/chrome/browser/previews/previews_ui_tab_helper.cc +++ b/chrome/browser/previews/previews_ui_tab_helper.cc
@@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/feature_list.h" -#include "build/build_config.h" #include "chrome/browser/loader/chrome_navigation_data.h" #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h" @@ -56,6 +55,11 @@ PreviewsUITabHelper::~PreviewsUITabHelper() {} +PreviewsUITabHelper::PreviewsUITabHelper(content::WebContents* web_contents) + : content::WebContentsObserver(web_contents) { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); +} + void PreviewsUITabHelper::ShowUIElement( previews::PreviewsType previews_type, base::Time previews_freshness, @@ -68,6 +72,8 @@ previews::PreviewsUIService* previews_ui_service = previews_service ? previews_service->previews_ui_service() : nullptr; + on_dismiss_callback_ = std::move(on_dismiss_callback); + #if defined(OS_ANDROID) if (base::FeatureList::IsEnabled( previews::features::kAndroidOmniboxPreviewsBadge)) { @@ -76,14 +82,44 @@ } #endif - PreviewsInfoBarDelegate::Create( - web_contents(), previews_type, previews_freshness, is_data_saver_user, - is_reload, std::move(on_dismiss_callback), previews_ui_service); + PreviewsInfoBarDelegate::Create(web_contents(), previews_type, + previews_freshness, is_data_saver_user, + is_reload, previews_ui_service); } -PreviewsUITabHelper::PreviewsUITabHelper(content::WebContents* web_contents) - : content::WebContentsObserver(web_contents) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); +void PreviewsUITabHelper::ReloadWithoutPreviews() { + DCHECK(previews_user_data_); + ReloadWithoutPreviews(previews_user_data_->committed_previews_type()); +} + +void PreviewsUITabHelper::ReloadWithoutPreviews( + previews::PreviewsType previews_type) { +#if defined(OS_ANDROID) + should_display_android_omnibox_badge_ = false; +#endif + if (on_dismiss_callback_) + std::move(on_dismiss_callback_).Run(true); + switch (previews_type) { + case previews::PreviewsType::LITE_PAGE: + case previews::PreviewsType::LITE_PAGE_REDIRECT: + case previews::PreviewsType::OFFLINE: + case previews::PreviewsType::NOSCRIPT: + case previews::PreviewsType::RESOURCE_LOADING_HINTS: + // Previews may cause a redirect, so we should use the original URL. The + // black list prevents showing the preview again. + web_contents()->GetController().Reload( + content::ReloadType::ORIGINAL_REQUEST_URL, true); + break; + case previews::PreviewsType::LOFI: + web_contents()->ReloadLoFiImages(); + break; + case previews::PreviewsType::NONE: + case previews::PreviewsType::UNSPECIFIED: + case previews::PreviewsType::LAST: + case previews::PreviewsType::DEPRECATED_AMP_REDIRECTION: + NOTREACHED(); + break; + } } void PreviewsUITabHelper::DidFinishNavigation( @@ -94,7 +130,9 @@ return; previews_user_data_.reset(); +#if defined(OS_ANDROID) should_display_android_omnibox_badge_ = false; +#endif // Store Previews information for this navigation. ChromeNavigationData* nav_data = static_cast<ChromeNavigationData*>( navigation_handle->GetNavigationData()); @@ -149,14 +187,14 @@ true, data_use_measurement::DataUseUserData::OTHER, 0); - PreviewsUITabHelper::ShowUIElement( - previews::PreviewsType::OFFLINE, base::Time() /* previews_freshness */, - data_reduction_proxy_settings && data_saver_enabled, - false /* is_reload */, - base::BindOnce(&AddPreviewNavigationCallback, - web_contents()->GetBrowserContext(), - navigation_handle->GetRedirectChain()[0], - previews::PreviewsType::OFFLINE, page_id)); + ShowUIElement(previews::PreviewsType::OFFLINE, + base::Time() /* previews_freshness */, + data_reduction_proxy_settings && data_saver_enabled, + false /* is_reload */, + base::BindOnce(&AddPreviewNavigationCallback, + web_contents()->GetBrowserContext(), + navigation_handle->GetRedirectChain()[0], + previews::PreviewsType::OFFLINE, page_id)); // Don't try to show other UIs if this is an offline preview. return; @@ -177,13 +215,12 @@ headers->GetDateValue(&previews_freshness); } - PreviewsUITabHelper::ShowUIElement( - main_frame_preview, previews_freshness, true /* is_data_saver_user */, - is_reload, - base::BindOnce(&AddPreviewNavigationCallback, - web_contents()->GetBrowserContext(), - navigation_handle->GetRedirectChain()[0], - main_frame_preview, page_id)); + ShowUIElement(main_frame_preview, previews_freshness, + true /* is_data_saver_user */, is_reload, + base::BindOnce(&AddPreviewNavigationCallback, + web_contents()->GetBrowserContext(), + navigation_handle->GetRedirectChain()[0], + main_frame_preview, page_id)); } } }
diff --git a/chrome/browser/previews/previews_ui_tab_helper.h b/chrome/browser/previews/previews_ui_tab_helper.h index 14c4a4e6..2d0c9408 100644 --- a/chrome/browser/previews/previews_ui_tab_helper.h +++ b/chrome/browser/previews/previews_ui_tab_helper.h
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "base/optional.h" #include "base/time/time.h" +#include "build/build_config.h" #include "components/previews/core/previews_experiments.h" #include "components/previews/core/previews_user_data.h" #include "content/public/browser/web_contents_observer.h" @@ -31,6 +32,13 @@ bool is_reload, OnDismissPreviewsUICallback on_dismiss_callback); + // Reloads the content of the page without previews. + void ReloadWithoutPreviews(); + + // Reloads the content of the page without previews for the given preview + // type. + void ReloadWithoutPreviews(previews::PreviewsType previews_type); + // Indicates whether the UI for a preview has been shown for the page. bool displayed_preview_ui() const { return displayed_preview_ui_; } @@ -41,11 +49,13 @@ displayed_preview_ui_ = displayed; } +#if defined(OS_ANDROID) // Indicates whether the Android Omnibox badge should be shown as the Previews // UI. bool should_display_android_omnibox_badge() const { return should_display_android_omnibox_badge_; } +#endif // Sets whether the timestamp on the UI for a preview has been shown for // the page. |displayed_preview_timestamp_| is reset to false on @@ -76,8 +86,13 @@ // True if the UI with a timestamp was shown for the page. bool displayed_preview_timestamp_ = false; +#if defined(OS_ANDROID) // True if the Android Omnibox badge should be shown as the Previews UI. bool should_display_android_omnibox_badge_ = false; +#endif + + // The callback to run when the original page is loaded. + OnDismissPreviewsUICallback on_dismiss_callback_; // The Previews information related to the navigation that was most recently // finished.
diff --git a/chrome/browser/resources/chromeos/arc_support/playstore.css b/chrome/browser/resources/chromeos/arc_support/playstore.css index d8d3a5c..42cf2cb6 100644 --- a/chrome/browser/resources/chromeos/arc_support/playstore.css +++ b/chrome/browser/resources/chromeos/arc_support/playstore.css
@@ -9,6 +9,15 @@ text-decoration: none; } +/* Disable links in offline ToS, because they cannot be loaded anyway. */ +.offline-terms a, +.offline-terms a:link, +.offline-terms a:visited { + color: rgba(0, 0, 0, 0.87); + pointer-events: none; + text-decoration: none; +} + body { margin: 0; padding: 8px 4px 8px 8px;
diff --git a/chrome/browser/resources/chromeos/login/oobe.js b/chrome/browser/resources/chromeos/login/oobe.js index 2d81953..a4bab1e 100644 --- a/chrome/browser/resources/chromeos/login/oobe.js +++ b/chrome/browser/resources/chromeos/login/oobe.js
@@ -21,6 +21,7 @@ // <include src="oobe_screen_update.js"> // <include src="oobe_screen_welcome.js"> // <include src="multi_tap_detector.js"> +// <include src="web_view_helper.js"> cr.define('cr.ui.Oobe', function() { return {
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_eula.js b/chrome/browser/resources/chromeos/login/oobe_screen_eula.js index 1293d5b..93d6baaa 100644 --- a/chrome/browser/resources/chromeos/login/oobe_screen_eula.js +++ b/chrome/browser/resources/chromeos/login/oobe_screen_eula.js
@@ -18,53 +18,6 @@ '}' }; - /** - * Load text/html contents from the given url into the given webview. The - * contents is loaded via XHR and is sent to webview via data url so that it - * is properly sandboxed. - * - * @param {!WebView} webview Webview element to host the terms. - * @param {!string} url URL to load terms contents. - */ - function loadUrlToWebview(webview, url) { - assert(webview.tagName === 'WEBVIEW'); - - var onError = function() { - webview.src = 'about:blank'; - }; - - var setContents = function(contents) { - webview.src = - 'data:text/html;charset=utf-8,' + encodeURIComponent(contents); - }; - - var xhr = new XMLHttpRequest(); - xhr.open('GET', url); - xhr.setRequestHeader('Accept', 'text/html'); - xhr.onreadystatechange = function() { - if (xhr.readyState != 4) - return; - if (xhr.status != 200) { - onError(); - return; - } - - var contentType = xhr.getResponseHeader('Content-Type'); - if (contentType && !/text\/html/.test(contentType)) { - onError(); - return; - } - - setContents(xhr.response); - }; - - try { - xhr.send(); - } catch (e) { - onError(); - } - } - // A class to wrap online contents loading for a webview. A PendingLoad is // constructed with a target webview, an url to load, a load timeout and an // error callback. It attaches to a "pendingLoad" property of |webview| after @@ -238,7 +191,7 @@ var TERMS_URL = 'chrome://terms'; var loadBundledEula = function() { - loadUrlToWebview(webview, TERMS_URL); + WebViewHelper.loadUrlToWebview(webview, TERMS_URL); }; webview.addContentScripts([{
diff --git a/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js b/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js index a806532..065eb57 100644 --- a/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js +++ b/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js
@@ -11,7 +11,7 @@ EXTERNAL_API: [ 'setMetricsMode', 'setBackupAndRestoreMode', 'setLocationServicesMode', 'loadPlayStoreToS', 'setArcManaged', 'hideSkipButton', 'setupForDemoMode', - 'setTosForTesting' + 'clearDemoMode', 'setTosForTesting' ], /** @override */ @@ -207,7 +207,7 @@ if (this.language_ && this.language_ == language && this.countryCode_ && this.countryCode_ == countryCode && - !this.classList.contains('error')) { + !this.classList.contains('error') && !this.usingOfflineTerms_) { this.enableButtons_(true); return; } @@ -411,6 +411,7 @@ */ reloadPlayStoreToS: function() { this.termsError = false; + this.usingOfflineTerms_ = false; var termsView = this.getElement_('arc-tos-view'); termsView.src = 'https://play.google.com/about/play-terms.html'; this.removeClass_('arc-tos-loaded'); @@ -427,6 +428,13 @@ }, /** + * Sets up the variant of the screen dedicated for demo mode. + */ + clearDemoMode: function() { + this.removeClass_('arc-tos-for-demo-mode'); + }, + + /** * Adds new class to the list of classes of root OOBE style. * @param {string} className class to remove. * @@ -468,9 +476,22 @@ return; } - var getToSContent = {code: 'getToSContent();'}; var termsView = this.getElement_('arc-tos-view'); - termsView.executeScript(getToSContent, this.onGetToSContent_.bind(this)); + if (this.usingOfflineTerms_) { + // Process offline ToS. Scripts added to web view by addContentScripts() + // are not executed when using data url. + this.tosContent_ = termsView.src; + var setParameters = + `document.body.classList.add('large-view', 'offline-terms');`; + termsView.executeScript({code: setParameters}); + termsView.insertCSS({file: 'playstore.css'}); + this.setTermsViewContentLoadedState_(); + } else { + // Process online ToS. + var getToSContent = {code: 'getToSContent();'}; + termsView.executeScript( + getToSContent, this.onGetToSContent_.bind(this)); + } }, /** @@ -483,6 +504,15 @@ } this.tosContent_ = results[0]; + this.setTermsViewContentLoadedState_(); + }, + + /** + * Sets the screen in the loaded state. Should be called after arc terms + * were loaded. + * @private + */ + setTermsViewContentLoadedState_: function() { this.removeClass_('arc-tos-loading'); this.removeClass_('error'); this.addClass_('arc-tos-loaded'); @@ -522,6 +552,14 @@ * Handles event when terms view cannot be loaded. */ onTermsViewErrorOccurred: function(details) { + // If in demo mode fallback to offline Terms of Service copy. + if (this.isDemoModeSetup_()) { + this.usingOfflineTerms_ = true; + const TERMS_URL = 'chrome://terms/arc'; + var webView = this.getElement_('arc-tos-view'); + WebViewHelper.loadUrlToWebview(webView, TERMS_URL); + return; + } this.showError_(); }, @@ -557,7 +595,7 @@ $('arc-tos-root').onBeforeShow(); - isDemoModeSetup = this.hasClass_('arc-tos-for-demo-mode'); + var isDemoModeSetup = this.isDemoModeSetup_(); if (isDemoModeSetup) { this.hideSkipButton(); this.setMetricsMode( @@ -576,7 +614,6 @@ /** @override */ onBeforeHide: function() { - this.removeClass_('arc-tos-for-demo-mode'); this.reset_(); }, @@ -678,6 +715,15 @@ event.stopPropagation(); self.showLearnMoreOverlay(learnMorePaiServiceText); }; + }, + + /** + * Returns whether arc terms are shown as a part of demo mode setup. + * @return {boolean} + * @private + */ + isDemoModeSetup_: function() { + return this.hasClass_('arc-tos-for-demo-mode'); } }; });
diff --git a/chrome/browser/resources/chromeos/login/web_view_helper.js b/chrome/browser/resources/chromeos/login/web_view_helper.js new file mode 100644 index 0000000..846eff7 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/web_view_helper.js
@@ -0,0 +1,57 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview Web view helper. + */ + +/** Web view helper shared between OOBE screens. */ +class WebViewHelper { + /** + * Loads text/html contents from the given url into the given webview. The + * content is loaded via XHR and is sent to webview via data url so that it + * is properly sandboxed. + * + * @param {!WebView} webView web view element to host the text/html content. + * @param {string} url URL to load text/html from. + */ + static loadUrlToWebview(webView, url) { + assert(webView.tagName === 'WEBVIEW'); + + const onError = function() { + webView.src = 'about:blank'; + }; + + const setContents = function(contents) { + webView.src = + 'data:text/html;charset=utf-8,' + encodeURIComponent(contents); + }; + + var xhr = new XMLHttpRequest(); + xhr.open('GET', url); + xhr.setRequestHeader('Accept', 'text/html'); + xhr.onreadystatechange = function() { + if (xhr.readyState != XMLHttpRequest.DONE) + return; + if (xhr.status != 200) { + onError(); + return; + } + + var contentType = xhr.getResponseHeader('Content-Type'); + if (contentType && !contentType.includes('text/html')) { + onError(); + return; + } + + setContents(xhr.response); + }; + + try { + xhr.send(); + } catch (e) { + onError(); + } + } +} \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/multidevice_setup/button_bar.html b/chrome/browser/resources/chromeos/multidevice_setup/button_bar.html index f6038dc1..c11d22f 100644 --- a/chrome/browser/resources/chromeos/multidevice_setup/button_bar.html +++ b/chrome/browser/resources/chromeos/multidevice_setup/button_bar.html
@@ -1,15 +1,13 @@ <link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html"> -<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> +<link rel="import" href="multidevice_setup_shared_css.html"> <!-- TODO(jordynass): Implement OOBE style and make the visible style dependent on the MultiDeviceSetup.uiMode property. --> <dom-module id="button-bar"> <template> - <style include="iron-flex paper-button-style cr-shared-style"> + <style include="multidevice-setup-shared"> :host { @apply(--layout-end-justified); @apply(--layout-horizontal);
diff --git a/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup.html b/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup.html index 26bff2d..b0100b7 100644 --- a/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup.html +++ b/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup.html
@@ -1,12 +1,12 @@ <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/cr.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-pages/iron-pages.html"> <link rel="import" href="button_bar.html"> <link rel="import" href="fake_mojo_service.html"> <link rel="import" href="i18n_setup.html"> <link rel="import" href="mojo_api_behavior.html"> +<link rel="import" href="multidevice_setup_shared_css.html"> <link rel="import" href="password_page.html"> <link rel="import" href="setup_failed_page.html"> <link rel="import" href="setup_succeeded_page.html"> @@ -15,15 +15,12 @@ <dom-module id="multidevice-setup"> <template> - <style> + <style include="multidevice-setup-shared"> :host { @apply(--layout-vertical); - @apply(--layout-start-justified); - padding: 60px 32px 32px 32px; - } - - button-bar { - margin-top: 40px; + box-sizing: border-box; + height: 100%; + padding: 60px 64px 32px 64px; } </style> <iron-pages attr-for-selected="is" @@ -41,6 +38,7 @@ selected-device-id="{{selectedDeviceId_}}"> </start-setup-page> </iron-pages> + <div class="flex"></div> <button-bar forward-button-text="[[visiblePage_.forwardButtonText]]" forward-button-disabled="[[forwardButtonDisabled_]]" backward-button-text="[[visiblePage_.backwardButtonText]]">
diff --git a/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_shared_css.html b/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_shared_css.html index d6957798..c940312 100644 --- a/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_shared_css.html +++ b/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_shared_css.html
@@ -1,17 +1,15 @@ <link rel="import" href="chrome://resources/html/polymer.html"> +<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html"> +<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> +<link rel="import" href="chrome://resources/html/md_select_css.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout.html"> <dom-module id="multidevice-setup-shared"> <template> - <style> - .page-content-text { - color: var(--google-grey-700); - font-family: Roboto-Regular, Roboto, sans-serif; - font-size: 13px; - line-height: 1.4; - } - + <style include="iron-flex paper-button-style cr-shared-style md-select"> a { color: var(--google-blue-600); text-decoration: none;
diff --git a/chrome/browser/resources/chromeos/multidevice_setup/password_page.html b/chrome/browser/resources/chromeos/multidevice_setup/password_page.html index c0b02b7..6fd2060 100644 --- a/chrome/browser/resources/chromeos/multidevice_setup/password_page.html +++ b/chrome/browser/resources/chromeos/multidevice_setup/password_page.html
@@ -2,12 +2,13 @@ <link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"> <link rel="import" href="chrome://resources/html/cr.html"> +<link rel="import" href="multidevice_setup_shared_css.html"> <link rel="import" href="ui_page.html"> <link rel="import" href="ui_page_container_behavior.html"> <dom-module id="password-page"> <template> - <style> + <style include="multidevice-setup-shared"> #user-info-container { @apply(--layout-horizontal); border: 1px solid rgb(95, 99, 104);
diff --git a/chrome/browser/resources/chromeos/multidevice_setup/setup_succeeded_page.html b/chrome/browser/resources/chromeos/multidevice_setup/setup_succeeded_page.html index 3d732233..e8581b3 100644 --- a/chrome/browser/resources/chromeos/multidevice_setup/setup_succeeded_page.html +++ b/chrome/browser/resources/chromeos/multidevice_setup/setup_succeeded_page.html
@@ -1,14 +1,14 @@ <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/cr.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="multidevice_setup_browser_proxy.html"> +<link rel="import" href="multidevice_setup_shared_css.html"> <link rel="import" href="ui_page.html"> <link rel="import" href="ui_page_container_behavior.html"> <dom-module id="setup-succeeded-page"> <template> - <style include="iron-flex"> + <style include="multidevice-setup-shared"> #page-icon-container { @apply(--layout-horizontal); @apply(--layout-center-justified);
diff --git a/chrome/browser/resources/chromeos/multidevice_setup/start_setup_page.html b/chrome/browser/resources/chromeos/multidevice_setup/start_setup_page.html index 46441b82..f89ed7e 100644 --- a/chrome/browser/resources/chromeos/multidevice_setup/start_setup_page.html +++ b/chrome/browser/resources/chromeos/multidevice_setup/start_setup_page.html
@@ -1,8 +1,6 @@ <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/cr.html"> -<link rel="import" href="chrome://resources/html/md_select_css.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="icons.html"> <link rel="import" href="multidevice_setup_shared_css.html"> @@ -11,13 +9,13 @@ <dom-module id="start-setup-page"> <template> - <style include="iron-flex multidevice-setup-shared md-select"> + <style include="multidevice-setup-shared"> #selector-and-details-container { @apply(--layout-horizontal); - color: rgb(33, 33, 36); - font-family: Roboto-Regular, Roboto, sans-serif; - font-size: 13px; - padding: 8px 8px 8px 0; + } + + #deviceDropdown { + margin-top: 16px; } #page-icon-container { @@ -29,7 +27,7 @@ background-image: -webkit-image-set(url(start_setup_icon_1x.png) 1x, url(start_setup_icon_2x.png) 2x); height: 116px; - margin-top: 20px; + margin-top: 10px; width: 320px; }
diff --git a/chrome/browser/resources/chromeos/multidevice_setup/ui_page.html b/chrome/browser/resources/chromeos/multidevice_setup/ui_page.html index 4069ec2..bd8ec9f1 100644 --- a/chrome/browser/resources/chromeos/multidevice_setup/ui_page.html +++ b/chrome/browser/resources/chromeos/multidevice_setup/ui_page.html
@@ -1,18 +1,12 @@ <link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="icons.html"> <link rel="import" href="multidevice_setup_shared_css.html"> <dom-module id="ui-page"> <template> - <style include="iron-flex iron-flex-alignment multidevice-setup-shared"> - #ui-page-container { - padding-left: 32px; - padding-right: 32px; - } - + <style include="multidevice-setup-shared"> iron-icon { --iron-icon-width: 32px; --iron-icon-height: 32px; @@ -22,6 +16,7 @@ color: rgb(32, 33, 36); font-family: 'Google Sans'; font-size: 28px; + line-height: 28px; margin: 0; padding-top: 36px; } @@ -29,16 +24,18 @@ #message-container { padding-top: 16px; } + + #additional-content-container { + padding-top: 48px; + } </style> - <div id="ui-page-container"> - <iron-icon icon="[[computeIconIdentifier_(iconName)]]"></iron-icon> - <h1>[[headerText]]</h1> - <div id="message-container" class="page-content-text"> - <slot name="message"></slot> - </div> - <div id="additional-content-container" class="page-content-text"> - <slot name="additional-content"></slot> - </div> + <iron-icon icon="[[computeIconIdentifier_(iconName)]]"></iron-icon> + <h1>[[headerText]]</h1> + <div id="message-container"> + <slot name="message"></slot> + </div> + <div id="additional-content-container"> + <slot name="additional-content"></slot> </div> </template> <script src="ui_page.js"></script>
diff --git a/chrome/browser/resources/settings/downloads_page/smb_browser_proxy.js b/chrome/browser/resources/settings/downloads_page/smb_browser_proxy.js index e32cc6e4..5085ce6 100644 --- a/chrome/browser/resources/settings/downloads_page/smb_browser_proxy.js +++ b/chrome/browser/resources/settings/downloads_page/smb_browser_proxy.js
@@ -19,6 +19,7 @@ NOT_FOUND: 3, UNSUPPORTED_DEVICE: 4, MOUNT_EXISTS: 5, + INVALID_URL: 6, }; cr.define('settings', function() {
diff --git a/chrome/browser/resources/settings/downloads_page/smb_shares_page.js b/chrome/browser/resources/settings/downloads_page/smb_shares_page.js index 35a18df..0d2a31f 100644 --- a/chrome/browser/resources/settings/downloads_page/smb_shares_page.js +++ b/chrome/browser/resources/settings/downloads_page/smb_shares_page.js
@@ -64,6 +64,10 @@ this.addShareResultText_ = loadTimeData.getString('smbShareAddedMountExistsMessage'); break; + case SmbMountResult.INVALID_URL: + this.addShareResultText_ = + loadTimeData.getString('smbShareAddedInvalidURLMessage'); + break; default: this.addShareResultText_ = loadTimeData.getString('smbShareAddedErrorMessage');
diff --git a/chrome/browser/sessions/chrome_tab_restore_service_client.cc b/chrome/browser/sessions/chrome_tab_restore_service_client.cc index 17b168f..4f34b48e 100644 --- a/chrome/browser/sessions/chrome_tab_restore_service_client.cc +++ b/chrome/browser/sessions/chrome_tab_restore_service_client.cc
@@ -13,12 +13,8 @@ #include "extensions/buildflags/buildflags.h" #if BUILDFLAG(ENABLE_EXTENSIONS) +#include "chrome/browser/apps/platform_apps/platform_app_launch.h" #include "chrome/browser/extensions/tab_helper.h" -#include "chrome/common/extensions/extension_constants.h" -#include "chrome/common/extensions/extension_metrics.h" -#include "extensions/browser/extension_registry.h" -#include "extensions/common/extension.h" -#include "extensions/common/extension_set.h" #endif #if !defined(OS_ANDROID) @@ -27,24 +23,6 @@ #include "chrome/browser/ui/android/tab_model/android_live_tab_context.h" #endif -namespace { - -void RecordAppLaunch(Profile* profile, const GURL& url) { -#if BUILDFLAG(ENABLE_EXTENSIONS) - const extensions::Extension* extension = - extensions::ExtensionRegistry::Get(profile) - ->enabled_extensions() - .GetAppByURL(url); - if (!extension) - return; - - extensions::RecordAppLaunchType( - extension_misc::APP_LAUNCH_NTP_RECENTLY_CLOSED, extension->GetType()); -#endif // BUILDFLAG(ENABLE_EXTENSIONS) -} - -} // namespace - ChromeTabRestoreServiceClient::ChromeTabRestoreServiceClient(Profile* profile) : profile_(profile) {} @@ -98,13 +76,9 @@ extensions::TabHelper* extensions_tab_helper = extensions::TabHelper::FromWebContents( static_cast<sessions::ContentLiveTab*>(tab)->web_contents()); - // extensions_tab_helper is NULL in some browser tests. - if (extensions_tab_helper) { - const extensions::Extension* extension = - extensions_tab_helper->extension_app(); - if (extension) - extension_app_id = extension->id(); - } + // extensions_tab_helper is nullptr in some browser tests. + if (extensions_tab_helper) + extension_app_id = extensions_tab_helper->GetAppId(); #endif return extension_app_id; @@ -146,5 +120,7 @@ } void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) { - RecordAppLaunch(profile_, url); +#if BUILDFLAG(ENABLE_EXTENSIONS) + apps::RecordExtensionAppLaunchOnTabRestored(profile_, url); +#endif // BUILDFLAG(ENABLE_EXTENSIONS) }
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 0efe88b..8b1627bc 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc
@@ -47,7 +47,6 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/session_storage_namespace.h" #include "content/public/browser/web_contents.h" -#include "extensions/common/extension.h" #if defined(OS_MACOSX) #include "chrome/browser/app_controller_mac.h" @@ -318,12 +317,10 @@ session_tab_helper->session_id()); extensions::TabHelper* extensions_tab_helper = extensions::TabHelper::FromWebContents(contents); - if (extensions_tab_helper && - extensions_tab_helper->extension_app()) { - SetTabExtensionAppID( - session_tab_helper->window_id(), - session_tab_helper->session_id(), - extensions_tab_helper->extension_app()->id()); + if (extensions_tab_helper && extensions_tab_helper->is_app()) { + SetTabExtensionAppID(session_tab_helper->window_id(), + session_tab_helper->session_id(), + extensions_tab_helper->GetAppId()); } // Record the association between the SessionStorageNamespace and the @@ -650,11 +647,10 @@ extensions::TabHelper* extensions_tab_helper = extensions::TabHelper::FromWebContents(tab); - if (extensions_tab_helper->extension_app()) { + if (extensions_tab_helper->is_app()) { base_session_service_->AppendRebuildCommand( sessions::CreateSetTabExtensionAppIDCommand( - session_id, - extensions_tab_helper->extension_app()->id())); + session_id, extensions_tab_helper->GetAppId())); } const std::string& ua_override = tab->GetUserAgentOverride();
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index 545c2eb9..3ff4590 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc
@@ -998,7 +998,9 @@ #if BUILDFLAG(ENABLE_SUPERVISED_USERS) bool ThemeService::IsSupervisedUser() const { - return profile_->IsSupervised(); + // Do not treat child users as supervised users, so they get the same theme as the parent account + // instead of getting the default theme. + return profile_->IsLegacySupervised(); } void ThemeService::SetSupervisedUserTheme() {
diff --git a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc index ab5983e..2e4acce 100644 --- a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc +++ b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc
@@ -555,10 +555,6 @@ case BubbleType::INACTIVE: NOTREACHED(); } - - if (observer_for_testing_) { - observer_for_testing_->OnBubbleShown(); - } } void SaveCardBubbleControllerImpl::UpdateIcon() {
diff --git a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h index 6ece42e..c7f9a56 100644 --- a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h +++ b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
@@ -31,13 +31,6 @@ public content::WebContentsObserver, public content::WebContentsUserData<SaveCardBubbleControllerImpl> { public: - // An observer class used by browsertests that gets notified whenever - // particular actions occur. - class ObserverForTest { - public: - virtual void OnBubbleShown() = 0; - }; - ~SaveCardBubbleControllerImpl() override; // Sets up the controller for local save and shows the bubble. @@ -130,7 +123,6 @@ private: friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>; - friend class SaveCardBubbleViewsBrowserTestBase; void FetchAccountInfo(); @@ -141,11 +133,6 @@ void OpenUrl(const GURL& url); - // For testing. - void SetEventObserverForTesting(ObserverForTest* observer) { - observer_for_testing_ = observer; - } - // The web_contents associated with this controller. content::WebContents* web_contents_; @@ -203,9 +190,6 @@ // The security level for the current context. security_state::SecurityLevel security_level_; - // Observer for when a bubble is created. Initialized only during tests. - ObserverForTest* observer_for_testing_ = nullptr; - DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl); };
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 36d8a26..b259a0e 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -2196,8 +2196,8 @@ // installed. if ((web_contents->GetURL().SchemeIs(extensions::kExtensionScheme) && web_contents->GetURL().host_piece() == extension->id()) || - (extensions::TabHelper::FromWebContents(web_contents) - ->extension_app() == extension)) { + (extensions::TabHelper::FromWebContents(web_contents)->GetAppId() == + extension->id())) { tab_strip_model_->CloseWebContentsAt(i, TabStripModel::CLOSE_NONE); } else { chrome::UnmuteIfMutedByExtension(web_contents, extension->id());
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index c60ac69..97a308d 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc
@@ -1396,8 +1396,7 @@ // Apps launched in a window from the NTP have an extensions tab helper with // extension_app set. ASSERT_TRUE(extensions::TabHelper::FromWebContents(app_window)); - EXPECT_TRUE( - extensions::TabHelper::FromWebContents(app_window)->extension_app()); + EXPECT_TRUE(extensions::TabHelper::FromWebContents(app_window)->is_app()); EXPECT_EQ(extensions::AppLaunchInfo::GetFullLaunchURL(extension_app), app_window->GetURL());
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index dc104b41..3d32042 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc
@@ -210,7 +210,7 @@ extensions::TabHelper::FromWebContents(params.source_contents); if (extensions_tab_helper && extensions_tab_helper->is_app()) { app_name = web_app::GenerateApplicationNameFromAppId( - extensions_tab_helper->extension_app()->id()); + extensions_tab_helper->GetAppId()); } } #endif
diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc index d87748b..d03a42d97 100644 --- a/chrome/browser/ui/browser_ui_prefs.cc +++ b/chrome/browser/ui/browser_ui_prefs.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/ui/browser_ui_prefs.h" +#include <memory> + #include "base/numerics/safe_conversions.h" #include "build/build_config.h" #include "chrome/browser/first_run/first_run.h" @@ -122,4 +124,7 @@ #else registry->RegisterBooleanPref(prefs::kFullscreenAllowed, true); #endif + + registry->RegisterBooleanPref(prefs::kEnterpriseHardwarePlatformAPIEnabled, + false); }
diff --git a/chrome/browser/ui/fast_unload_controller.cc b/chrome/browser/ui/fast_unload_controller.cc index 7dc8982a..7fa178a 100644 --- a/chrome/browser/ui/fast_unload_controller.cc +++ b/chrome/browser/ui/fast_unload_controller.cc
@@ -96,7 +96,7 @@ // them. Once they have fired, we'll get a message back saying whether // to proceed closing the page or not, which sends us back to this method // with the NeedToFireBeforeUnload bit cleared. - contents->DispatchBeforeUnload(); + contents->DispatchBeforeUnload(false /* auto_cancel */); return true; } return false; @@ -420,7 +420,7 @@ // and then call beforeunload handlers for |contents|. // See DevToolsWindow::InterceptPageBeforeUnload for details. if (!DevToolsWindow::InterceptPageBeforeUnload(contents)) - contents->DispatchBeforeUnload(); + contents->DispatchBeforeUnload(false /* auto_cancel */); } else { ProcessPendingTabs(skip_beforeunload); }
diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc index db465d9d..4e1e9df 100644 --- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc +++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
@@ -19,7 +19,6 @@ #if BUILDFLAG(ENABLE_EXTENSIONS) #include "chrome/browser/extensions/tab_helper.h" -#include "extensions/common/extension.h" #endif #if BUILDFLAG(ENABLE_SUPERVISED_USERS) @@ -53,12 +52,10 @@ std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const { #if BUILDFLAG(ENABLE_EXTENSIONS) - const scoped_refptr<const extensions::Extension> extension_app( - extensions::TabHelper::FromWebContents(web_contents_)->extension_app()); - if (extension_app.get()) - return extension_app->id(); -#endif + return extensions::TabHelper::FromWebContents(web_contents_)->GetAppId(); +#else return std::string(); +#endif } bool TabContentsSyncedTabDelegate::IsInitialBlankNavigation() const {
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc index 354c395..cfa9c7a 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper.cc +++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc
@@ -273,7 +273,8 @@ } } -void CoreTabHelper::BeforeUnloadFired(const base::TimeTicks& proceed_time) { +void CoreTabHelper::BeforeUnloadFired(bool proceed, + const base::TimeTicks& proceed_time) { before_unload_end_time_ = proceed_time; }
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.h b/chrome/browser/ui/tab_contents/core_tab_helper.h index 1a3b8f2..d00190a 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper.h +++ b/chrome/browser/ui/tab_contents/core_tab_helper.h
@@ -76,7 +76,8 @@ void DidStartLoading() override; void OnVisibilityChanged(content::Visibility visibility) override; void WebContentsDestroyed() override; - void BeforeUnloadFired(const base::TimeTicks& proceed_time) override; + void BeforeUnloadFired(bool proceed, + const base::TimeTicks& proceed_time) override; void BeforeUnloadDialogCancelled() override; void NavigationEntriesDeleted() override;
diff --git a/chrome/browser/ui/unload_controller.cc b/chrome/browser/ui/unload_controller.cc index b770d2e..c963f06a 100644 --- a/chrome/browser/ui/unload_controller.cc +++ b/chrome/browser/ui/unload_controller.cc
@@ -91,7 +91,7 @@ // them. Once they have fired, we'll get a message back saying whether // to proceed closing the page or not, which sends us back to this method // with the NeedToFireBeforeUnload bit cleared. - contents->DispatchBeforeUnload(); + contents->DispatchBeforeUnload(false /* auto_cancel */); return true; } return false; @@ -327,7 +327,7 @@ // and then call beforeunload handlers for |web_contents|. // See DevToolsWindow::InterceptPageBeforeUnload for details. if (!DevToolsWindow::InterceptPageBeforeUnload(web_contents)) - web_contents->DispatchBeforeUnload(); + web_contents->DispatchBeforeUnload(false /* auto_cancel */); } else { ClearUnloadState(web_contents, true); }
diff --git a/chrome/browser/ui/views/autofill/dialog_view_ids.h b/chrome/browser/ui/views/autofill/dialog_view_ids.h index 4f298d5..d76f6d3 100644 --- a/chrome/browser/ui/views/autofill/dialog_view_ids.h +++ b/chrome/browser/ui/views/autofill/dialog_view_ids.h
@@ -22,9 +22,6 @@ SIGN_IN_PROMO_VIEW, // Contains the sign-in promo view MANAGE_CARDS_VIEW, // The manage cards view - // The sub-view that contains the sign-in button in the promo. - SIGN_IN_VIEW, - // The following are views::LabelButton objects (clickable). OK_BUTTON, // Can say [Save], [Next], [Confirm], // or [Done] depending on context
diff --git a/chrome/browser/ui/views/autofill/save_card_bubble_views.cc b/chrome/browser/ui/views/autofill/save_card_bubble_views.cc index 54005152..13b5bbc 100644 --- a/chrome/browser/ui/views/autofill/save_card_bubble_views.cc +++ b/chrome/browser/ui/views/autofill/save_card_bubble_views.cc
@@ -205,10 +205,9 @@ return view; } -void SaveCardBubbleViews::InitFootnoteView(views::View* footnote_view) { - DCHECK(!footnote_view_); +void SaveCardBubbleViews::SetFootnoteViewForTesting( + views::View* footnote_view) { footnote_view_ = footnote_view; - footnote_view_->set_id(DialogViewId::FOOTNOTE_VIEW); } void SaveCardBubbleViews::AssignIdsToDialogClientView() {
diff --git a/chrome/browser/ui/views/autofill/save_card_bubble_views.h b/chrome/browser/ui/views/autofill/save_card_bubble_views.h index 692015bb..008c1c0f 100644 --- a/chrome/browser/ui/views/autofill/save_card_bubble_views.h +++ b/chrome/browser/ui/views/autofill/save_card_bubble_views.h
@@ -83,8 +83,8 @@ // footnote. virtual std::unique_ptr<views::View> CreateMainContentView(); - // Called by sub-classes to initialize |footnote_view_|. - virtual void InitFootnoteView(views::View* footnote_view); + // Set the footnote view so that its accessible for testing. + void SetFootnoteViewForTesting(views::View* footnote_view); SaveCardBubbleController* controller() { return controller_; @@ -101,7 +101,11 @@ ~SaveCardBubbleViews() override; private: - friend class SaveCardBubbleViewsBrowserTestBase; + FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewsFullFormBrowserTest, + Upload_ClickingCloseClosesBubble); + FRIEND_TEST_ALL_PREFIXES( + SaveCardBubbleViewsFullFormBrowserTest, + Upload_DecliningUploadDoesNotLogUserAcceptedCardOriginUMA); views::View* footnote_view_ = nullptr;
diff --git a/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest.cc b/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest.cc index 21d9b8c..053d17c 100644 --- a/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest.cc +++ b/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest.cc
@@ -2,12 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <memory> #include <string> #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" -#include "base/test/metrics/user_action_tester.h" #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" @@ -15,7 +13,6 @@ #include "chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest_base.h" #include "components/autofill/core/browser/autofill_experiments.h" #include "components/autofill/core/common/autofill_features.h" -#include "components/signin/core/browser/signin_buildflags.h" #include "content/public/test/browser_test_utils.h" #include "net/url_request/test_url_fetcher_factory.h" #include "ui/views/bubble/bubble_frame_view.h" @@ -24,14 +21,6 @@ #include "ui/views/controls/textfield/textfield.h" #include "ui/views/window/dialog_client_view.h" -#if BUILDFLAG(ENABLE_DICE_SUPPORT) -#include "chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.h" -#endif - -#if defined(OS_CHROMEOS) -#include "chrome/browser/ui/settings_window_manager_chromeos.h" -#endif - using base::Bucket; using testing::ElementsAre; @@ -105,24 +94,17 @@ // Clicking [Save] should accept and close it. base::HistogramTester histogram_tester; - base::UserActionTester user_action_tester; ClickOnDialogViewWithIdAndWait(DialogViewId::OK_BUTTON); // UMA should have recorded bubble acceptance. histogram_tester.ExpectUniqueSample( "Autofill.SaveCreditCardPrompt.Local.FirstShow", AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1); - - // No bubble should be showing and no sign-in impression should have been - // recorded. - EXPECT_EQ(nullptr, GetSaveCardBubbleViews()); - EXPECT_FALSE(GetSaveCardIconView()->visible()); - EXPECT_EQ(0, user_action_tester.GetActionCount( - "Signin_Impression_FromSaveCardBubble")); + // The sign-in promo should not be shown because the experiment is disabled. + // TODO(crbug/855186): Add test that checks that sign-in promo is not showing. } // Tests the sign in promo bubble. Ensures that clicking the [Save] button // on the local save bubble successfully causes the sign in promo to show. -#if !defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, Local_ClickingSaveShowsSigninPromo) { // Enable the sign-in promo. @@ -144,24 +126,11 @@ EXPECT_TRUE( FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_LOCAL)->visible()); - // Adding an event observer to the controller so we can wait for the bubble to - // show. - AddEventObserverToController(); - ReduceAnimationTime(); - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - // Click [Save] should close the offer-to-save bubble // and pop up the sign-in promo. - base::UserActionTester user_action_tester; - ClickOnDialogViewWithId(DialogViewId::OK_BUTTON); - WaitForObservedEvent(); - - // Sign-in promo should be showing and user actions should have recorded - // impression. - EXPECT_TRUE( - FindViewInBubbleById(DialogViewId::SIGN_IN_PROMO_VIEW)->visible()); + // TODO(crbug/855186): Add test that checks that sign-in promo shows after + // clicking save. } -#endif // Tests the sign in promo bubble. Ensures that the sign-in promo // is not shown when the user is signed-in and syncing, even if @@ -192,381 +161,11 @@ // Click [Save] should close the offer-to-save bubble // but no sign-in promo should show because user is signed in. - base::UserActionTester user_action_tester; ClickOnDialogViewWithIdAndWait(DialogViewId::OK_BUTTON); - - // No bubble should be showing and no sign-in impression should have been - // recorded. - EXPECT_EQ(nullptr, GetSaveCardBubbleViews()); - EXPECT_EQ(0, user_action_tester.GetActionCount( - "Signin_Impression_FromSaveCardBubble")); + // TODO(crbug/855186): Add test that checks that sign-in promo + // is not showing. } -// Tests the sign in promo bubble. Ensures that signin impression is recorded -// when promo is shown. -#if !defined(OS_CHROMEOS) -IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Local_Metrics_SigninImpressionSigninPromo) { - // Enable the sign-in promo. - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillSaveCardSignInAfterLocalSave); - - // Set up the Payments RPC. - SetUploadDetailsRpcPaymentsDeclines(); - - // Submitting the form and having Payments decline offering to save should - // show the local save bubble. - // (Must wait for response from Payments before accessing the controller.) - ResetEventWaiterForSequence( - {DialogEvent::REQUESTED_UPLOAD_SAVE, - DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE, - DialogEvent::OFFERED_LOCAL_SAVE}); - FillAndSubmitForm(); - WaitForObservedEvent(); - - // Adding an event observer to the controller so we can wait for the bubble to - // show. - AddEventObserverToController(); - ReduceAnimationTime(); - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - - // Click [Save] should close the offer-to-save bubble - // and pop up the sign-in promo. - base::UserActionTester user_action_tester; - ClickOnDialogViewWithId(DialogViewId::OK_BUTTON); - WaitForObservedEvent(); - - // User actions should have recorded impression. - EXPECT_EQ(1, user_action_tester.GetActionCount( - "Signin_Impression_FromSaveCardBubble")); -} -#endif - -// Tests the sign in promo bubble. Ensures that signin action is recorded when -// user accepts promo. -#if BUILDFLAG(ENABLE_DICE_SUPPORT) -IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Local_Metrics_AcceptingSigninPromo) { - // Enable the sign-in promo. - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillSaveCardSignInAfterLocalSave); - - // Set up the Payments RPC. - SetUploadDetailsRpcPaymentsDeclines(); - - // Submitting the form and having Payments decline offering to save should - // show the local save bubble. - // (Must wait for response from Payments before accessing the controller.) - ResetEventWaiterForSequence( - {DialogEvent::REQUESTED_UPLOAD_SAVE, - DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE, - DialogEvent::OFFERED_LOCAL_SAVE}); - FillAndSubmitForm(); - WaitForObservedEvent(); - - // Adding an event observer to the controller so we can wait for the bubble to - // show. - AddEventObserverToController(); - ReduceAnimationTime(); - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - - // Click [Save] should close the offer-to-save bubble - // and pop up the sign-in promo. - base::UserActionTester user_action_tester; - ClickOnDialogViewWithId(DialogViewId::OK_BUTTON); - WaitForObservedEvent(); - - // Click on [Sign in] button. - ClickOnDialogView(static_cast<DiceBubbleSyncPromoView*>( - FindViewInBubbleById(DialogViewId::SIGN_IN_VIEW)) - ->GetSigninButtonForTesting()); - - // User actions should have recorded impression and click. - EXPECT_EQ(1, user_action_tester.GetActionCount( - "Signin_Impression_FromSaveCardBubble")); - EXPECT_EQ( - 1, user_action_tester.GetActionCount("Signin_Signin_FromSaveCardBubble")); -} -#endif - -// Tests the manage cards bubble. Ensures that it shows up by clicking the -// credit card icon. -IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Local_ClickingIconShowsManageCards) { - // Enable the sign-in promo. - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillSaveCardSignInAfterLocalSave); - - // Set up the Payments RPC. - SetUploadDetailsRpcPaymentsDeclines(); - - // Submitting the form and having Payments decline offering to save should - // show the local save bubble. - // (Must wait for response from Payments before accessing the controller.) - ResetEventWaiterForSequence( - {DialogEvent::REQUESTED_UPLOAD_SAVE, - DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE, - DialogEvent::OFFERED_LOCAL_SAVE}); - FillAndSubmitForm(); - WaitForObservedEvent(); - - // Adding an event observer to the controller so we can wait for the bubble to - // show. - AddEventObserverToController(); - ReduceAnimationTime(); - -#if !defined(OS_CHROMEOS) - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); -#endif - - // Click [Save] should close the offer-to-save bubble and show "Card saved" - // animation -- followed by the sign-in promo (if not on Chrome OS). - ClickOnDialogViewWithIdAndWait(DialogViewId::OK_BUTTON); - -#if !defined(OS_CHROMEOS) - // Wait for and then close the promo. - WaitForObservedEvent(); - ClickOnCloseButton(); -#endif - - // Open up Manage Cards prompt. - base::HistogramTester histogram_tester; - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - ClickOnView(GetSaveCardIconView()); - WaitForObservedEvent(); - - // Bubble should be showing. - EXPECT_TRUE(FindViewInBubbleById(DialogViewId::MANAGE_CARDS_VIEW)->visible()); - histogram_tester.ExpectUniqueSample("Autofill.ManageCardsPrompt.Local", - AutofillMetrics::MANAGE_CARDS_SHOWN, 1); -} - -// Tests the manage cards bubble. Ensures that clicking the [Manage cards] -// button redirects properly. -IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Local_ManageCardsButtonRedirects) { - // Enable the sign-in promo. - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillSaveCardSignInAfterLocalSave); - - // Set up the Payments RPC. - SetUploadDetailsRpcPaymentsDeclines(); - - // Submitting the form and having Payments decline offering to save should - // show the local save bubble. - // (Must wait for response from Payments before accessing the controller.) - ResetEventWaiterForSequence( - {DialogEvent::REQUESTED_UPLOAD_SAVE, - DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE, - DialogEvent::OFFERED_LOCAL_SAVE}); - FillAndSubmitForm(); - WaitForObservedEvent(); - - // Adding an event observer to the controller so we can wait for the bubble to - // show. - AddEventObserverToController(); - ReduceAnimationTime(); - -#if !defined(OS_CHROMEOS) - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); -#endif - - // Click [Save] should close the offer-to-save bubble and show "Card saved" - // animation -- followed by the sign-in promo (if not on Chrome OS). - ClickOnDialogViewWithIdAndWait(DialogViewId::OK_BUTTON); - -#if !defined(OS_CHROMEOS) - // Wait for and then close the promo. - WaitForObservedEvent(); - ClickOnCloseButton(); -#endif - - // Open up Manage Cards prompt. - base::HistogramTester histogram_tester; - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - ClickOnView(GetSaveCardIconView()); - WaitForObservedEvent(); - - // Click on the redirect button. - ClickOnDialogViewWithId(DialogViewId::MANAGE_CARDS_BUTTON); - -#if defined(OS_CHROMEOS) - // ChromeOS should have opened up the settings window. - EXPECT_TRUE( - chrome::SettingsWindowManager::GetInstance()->FindBrowserForProfile( - browser()->profile())); -#else - // Otherwise, another tab should have opened. - EXPECT_EQ(2, browser()->tab_strip_model()->count()); -#endif - - // Metrics should have been recorded correctly. - EXPECT_THAT( - histogram_tester.GetAllSamples("Autofill.ManageCardsPrompt.Local"), - ElementsAre(Bucket(AutofillMetrics::MANAGE_CARDS_SHOWN, 1), - Bucket(AutofillMetrics::MANAGE_CARDS_MANAGE_CARDS, 1))); -} - -// Tests the manage cards bubble. Ensures that clicking the [Done] -// button closes the bubble. -IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Local_ManageCardsDoneButtonClosesBubble) { - // Enable the sign-in promo. - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillSaveCardSignInAfterLocalSave); - - // Set up the Payments RPC. - SetUploadDetailsRpcPaymentsDeclines(); - - // Submitting the form and having Payments decline offering to save should - // show the local save bubble. - // (Must wait for response from Payments before accessing the controller.) - ResetEventWaiterForSequence( - {DialogEvent::REQUESTED_UPLOAD_SAVE, - DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE, - DialogEvent::OFFERED_LOCAL_SAVE}); - FillAndSubmitForm(); - WaitForObservedEvent(); - - // Adding an event observer to the controller so we can wait for the bubble to - // show. - AddEventObserverToController(); - ReduceAnimationTime(); - -#if !defined(OS_CHROMEOS) - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); -#endif - - // Click [Save] should close the offer-to-save bubble and show "Card saved" - // animation -- followed by the sign-in promo (if not on Chrome OS). - ClickOnDialogViewWithIdAndWait(DialogViewId::OK_BUTTON); - -#if !defined(OS_CHROMEOS) - // Wait for and then close the promo. - WaitForObservedEvent(); - ClickOnCloseButton(); -#endif - - // Open up Manage Cards prompt. - base::HistogramTester histogram_tester; - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - ClickOnView(GetSaveCardIconView()); - WaitForObservedEvent(); - - // Click on the [Done] button. - ClickOnDialogViewWithIdAndWait(DialogViewId::OK_BUTTON); - - // No bubble should be showing now and metrics should be recorded correctly. - EXPECT_EQ(nullptr, GetSaveCardBubbleViews()); - EXPECT_THAT( - histogram_tester.GetAllSamples("Autofill.ManageCardsPrompt.Local"), - ElementsAre(Bucket(AutofillMetrics::MANAGE_CARDS_SHOWN, 1), - Bucket(AutofillMetrics::MANAGE_CARDS_DONE, 1))); -} - -// Tests the manage cards bubble. Ensures that sign-in impression is recorded -// correctly. -#if !defined(OS_CHROMEOS) -IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Local_Metrics_SigninImpressionManageCards) { - // Enable the sign-in promo. - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillSaveCardSignInAfterLocalSave); - - // Set up the Payments RPC. - SetUploadDetailsRpcPaymentsDeclines(); - - // Submitting the form and having Payments decline offering to save should - // show the local save bubble. - // (Must wait for response from Payments before accessing the controller.) - ResetEventWaiterForSequence( - {DialogEvent::REQUESTED_UPLOAD_SAVE, - DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE, - DialogEvent::OFFERED_LOCAL_SAVE}); - FillAndSubmitForm(); - WaitForObservedEvent(); - - // Adding an event observer to the controller so we can wait for the bubble to - // show. - AddEventObserverToController(); - ReduceAnimationTime(); - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - - // Click [Save] should close the offer-to-save bubble - // and pop up the sign-in promo. - base::UserActionTester user_action_tester; - ClickOnDialogViewWithId(DialogViewId::OK_BUTTON); - WaitForObservedEvent(); - - // Close promo. - ClickOnCloseButton(); - - // Open up Manage Cards prompt. - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - ClickOnView(GetSaveCardIconView()); - WaitForObservedEvent(); - - // User actions should have recorded impression. - EXPECT_EQ(1, user_action_tester.GetActionCount( - "Signin_Impression_FromManageCardsBubble")); -} -#endif - -// Tests the Manage Cards bubble. Ensures that signin action is recorded when -// user accepts footnote promo. -#if BUILDFLAG(ENABLE_DICE_SUPPORT) -IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Local_Metrics_AcceptingFootnotePromoManageCards) { - // Enable the sign-in promo. - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillSaveCardSignInAfterLocalSave); - - // Set up the Payments RPC. - SetUploadDetailsRpcPaymentsDeclines(); - - // Submitting the form and having Payments decline offering to save should - // show the local save bubble. - // (Must wait for response from Payments before accessing the controller.) - ResetEventWaiterForSequence( - {DialogEvent::REQUESTED_UPLOAD_SAVE, - DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE, - DialogEvent::OFFERED_LOCAL_SAVE}); - FillAndSubmitForm(); - WaitForObservedEvent(); - - // Adding an event observer to the controller so we can wait for the bubble to - // show. - AddEventObserverToController(); - ReduceAnimationTime(); - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - - // Click [Save] should close the offer-to-save bubble - // and pop up the sign-in promo. - base::UserActionTester user_action_tester; - ClickOnDialogViewWithId(DialogViewId::OK_BUTTON); - WaitForObservedEvent(); - - // Close promo. - ClickOnCloseButton(); - - // Open up Manage Cards prompt. - ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN}); - ClickOnView(GetSaveCardIconView()); - WaitForObservedEvent(); - - // Click on [Sign in] button in footnote. - ClickOnDialogView(static_cast<DiceBubbleSyncPromoView*>( - FindViewInBubbleById(DialogViewId::FOOTNOTE_VIEW)) - ->GetSigninButtonForTesting()); - - // User actions should have recorded impression and click. - EXPECT_EQ(1, user_action_tester.GetActionCount( - "Signin_Impression_FromManageCardsBubble")); - EXPECT_EQ(1, user_action_tester.GetActionCount( - "Signin_Signin_FromManageCardsBubble")); -} -#endif - // Tests the local save bubble. Ensures that the Harmony version of the bubble // does not have a [No thanks] button (it has an [X] Close button instead.) IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, @@ -701,7 +300,8 @@ // Clicking the [X] close button should dismiss the bubble. base::HistogramTester histogram_tester; - ClickOnCloseButton(); + ClickOnDialogViewAndWait( + GetSaveCardBubbleViews()->GetBubbleFrameView()->GetCloseButtonForTest()); } // Tests the upload save bubble. Ensures that the bubble does not surface the @@ -1214,7 +814,8 @@ EXPECT_TRUE(FindViewInBubbleById(DialogViewId::FOOTNOTE_VIEW)->visible()); // Clicking the [X] close button should dismiss the bubble. - ClickOnCloseButton(); + ClickOnDialogViewAndWait( + GetSaveCardBubbleViews()->GetBubbleFrameView()->GetCloseButtonForTest()); // Ensure that UMA was logged correctly. histogram_tester.ExpectUniqueSample(
diff --git a/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest_base.cc b/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest_base.cc index 86cfa810..841ee5e8 100644 --- a/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest_base.cc +++ b/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest_base.cc
@@ -7,7 +7,6 @@ #include <list> #include <memory> #include <string> -#include <utility> #include "chrome/browser/signin/account_fetcher_service_factory.h" #include "chrome/browser/signin/account_tracker_service_factory.h" @@ -17,13 +16,9 @@ #include "chrome/browser/ui/autofill/chrome_autofill_client.h" #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/location_bar/location_bar.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/views/autofill/dialog_view_ids.h" #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" -#include "chrome/browser/ui/views/autofill/save_card_icon_view.h" -#include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/test/base/ui_test_utils.h" #include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/core/browser/credit_card_save_manager.h" @@ -139,11 +134,6 @@ event_waiter_->OnEvent(DialogEvent::SENT_UPLOAD_CARD_REQUEST); } -void SaveCardBubbleViewsBrowserTestBase::OnBubbleShown() { - if (event_waiter_) - event_waiter_->OnEvent(DialogEvent::BUBBLE_SHOWN); -} - void SaveCardBubbleViewsBrowserTestBase::SetUpInProcessBrowserTestFixture() { will_create_browser_context_services_subscription_ = BrowserContextDependencyManager::GetInstance() @@ -346,18 +336,6 @@ net::HTTP_INTERNAL_SERVER_ERROR); } -void SaveCardBubbleViewsBrowserTestBase::ClickOnView(views::View* view) { - DCHECK(view); - ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, - ui::EF_LEFT_MOUSE_BUTTON); - view->OnMousePressed(pressed); - ui::MouseEvent released_event = ui::MouseEvent( - ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), - ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); - view->OnMouseReleased(released_event); -} - void SaveCardBubbleViewsBrowserTestBase::ClickOnDialogView(views::View* view) { GetSaveCardBubbleViews() ->GetDialogClientView() @@ -368,7 +346,16 @@ ->non_client_view() ->frame_view()); bubble_frame_view->ResetViewShownTimeStampForTesting(); - ClickOnView(view); + + DCHECK(view); + ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), + ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); + view->OnMousePressed(pressed); + ui::MouseEvent released_event = ui::MouseEvent( + ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); + view->OnMouseReleased(released_event); } void SaveCardBubbleViewsBrowserTestBase::ClickOnDialogViewAndWait( @@ -420,13 +407,6 @@ return specified_view; } -void SaveCardBubbleViewsBrowserTestBase::ClickOnCloseButton() { - SaveCardBubbleViews* save_card_bubble_views = GetSaveCardBubbleViews(); - DCHECK(save_card_bubble_views); - ClickOnDialogViewAndWait( - save_card_bubble_views->GetBubbleFrameView()->GetCloseButtonForTest()); -} - SaveCardBubbleViews* SaveCardBubbleViewsBrowserTestBase::GetSaveCardBubbleViews() { SaveCardBubbleControllerImpl* save_card_bubble_controller_impl = @@ -440,31 +420,11 @@ return static_cast<SaveCardBubbleViews*>(save_card_bubble_view); } -SaveCardIconView* SaveCardBubbleViewsBrowserTestBase::GetSaveCardIconView() { - if (!browser()) - return nullptr; - LocationBarView* location_bar_view = - static_cast<LocationBarView*>(browser()->window()->GetLocationBar()); - DCHECK(location_bar_view->save_credit_card_icon_view()); - return location_bar_view->save_credit_card_icon_view(); -} - content::WebContents* SaveCardBubbleViewsBrowserTestBase::GetActiveWebContents() { return browser()->tab_strip_model()->GetActiveWebContents(); } -void SaveCardBubbleViewsBrowserTestBase::AddEventObserverToController() { - SaveCardBubbleControllerImpl* save_card_bubble_controller_impl = - SaveCardBubbleControllerImpl::FromWebContents(GetActiveWebContents()); - DCHECK(save_card_bubble_controller_impl); - save_card_bubble_controller_impl->SetEventObserverForTesting(this); -} - -void SaveCardBubbleViewsBrowserTestBase::ReduceAnimationTime() { - GetSaveCardIconView()->ReduceAnimationTimeForTesting(); -} - void SaveCardBubbleViewsBrowserTestBase::ResetEventWaiterForSequence( std::list<DialogEvent> event_sequence) { event_waiter_ =
diff --git a/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest_base.h b/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest_base.h index 481d931..4c8e110 100644 --- a/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest_base.h +++ b/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest_base.h
@@ -13,10 +13,8 @@ #include "base/command_line.h" #include "base/macros.h" #include "base/test/scoped_feature_list.h" -#include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" #include "chrome/browser/ui/views/autofill/dialog_view_ids.h" #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" -#include "chrome/browser/ui/views/autofill/save_card_icon_view.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/autofill/core/browser/credit_card_save_manager.h" #include "components/autofill/core/browser/test_event_waiter.h" @@ -38,8 +36,7 @@ // need to show and interact with the offer-to-save bubble. class SaveCardBubbleViewsBrowserTestBase : public InProcessBrowserTest, - public CreditCardSaveManager::ObserverForTest, - public SaveCardBubbleControllerImpl::ObserverForTest { + public CreditCardSaveManager::ObserverForTest { public: // Various events that can be waited on by the DialogEventWaiter. enum DialogEvent : int { @@ -47,7 +44,6 @@ REQUESTED_UPLOAD_SAVE, RECEIVED_GET_UPLOAD_DETAILS_RESPONSE, SENT_UPLOAD_CARD_REQUEST, - BUBBLE_SHOWN }; protected: @@ -67,9 +63,6 @@ void OnReceivedGetUploadDetailsResponse() override; void OnSentUploadCardRequest() override; - // SaveCardBubbleControllerImpl::ObserverForTest: - void OnBubbleShown() override; - // BrowserTestBase: void SetUpInProcessBrowserTestFixture() override; @@ -97,12 +90,9 @@ void SetUploadDetailsRpcServerError(); // Clicks on the given views::View*. - void ClickOnView(views::View* view); - - // Clicks on the given dialog views::View*. void ClickOnDialogView(views::View* view); - // Clicks on the given dialog views::View* and waits for the dialog to close. + // Clicks on the given views::View* and waits for the dialog to close. void ClickOnDialogViewAndWait(views::View* view); // Clicks on a view from within the dialog. @@ -114,26 +104,11 @@ // Returns the views::View* that was previously assigned the id |view_id|. views::View* FindViewInBubbleById(DialogViewId view_id); - // Assert that there is a SaveCardBubbleViews bubble open, then click on the - // [X] button. - void ClickOnCloseButton(); - // Gets the views::View* instance of the save credit card bubble. SaveCardBubbleViews* GetSaveCardBubbleViews(); - // Gets the views::View* instance of the credit card icon. - SaveCardIconView* GetSaveCardIconView(); - content::WebContents* GetActiveWebContents(); - // Adding an observer to the controller so we know when the sign-in promo - // shows after the animation. - void AddEventObserverToController(); - - // Reduces the animation time to one millisecond so that the test does not - // take long. - void ReduceAnimationTime(); - // Resets the event waiter for a given |event_sequence|. void ResetEventWaiterForSequence(std::list<DialogEvent> event_sequence); // Wait for the event(s) passed to ResetEventWaiter*() to occur.
diff --git a/chrome/browser/ui/views/autofill/save_card_icon_view.h b/chrome/browser/ui/views/autofill/save_card_icon_view.h index 9fd90f1..409d85ed 100644 --- a/chrome/browser/ui/views/autofill/save_card_icon_view.h +++ b/chrome/browser/ui/views/autofill/save_card_icon_view.h
@@ -38,8 +38,6 @@ const gfx::VectorIcon& GetVectorIcon() const override; private: - friend class SaveCardBubbleViewsBrowserTestBase; - SaveCardBubbleControllerImpl* GetController() const; // gfx::AnimationDelegate:
diff --git a/chrome/browser/ui/views/autofill/save_card_manage_cards_bubble_views.cc b/chrome/browser/ui/views/autofill/save_card_manage_cards_bubble_views.cc index 80a01bf..6891ab9e 100644 --- a/chrome/browser/ui/views/autofill/save_card_manage_cards_bubble_views.cc +++ b/chrome/browser/ui/views/autofill/save_card_manage_cards_bubble_views.cc
@@ -35,7 +35,7 @@ if (!controller()->ShouldShowSignInPromo()) return nullptr; - views::View* promo_view = nullptr; + views::View* footnote_view_ = nullptr; Profile* profile = controller()->GetProfile(); sync_promo_delegate_ = @@ -44,7 +44,7 @@ signin_metrics::AccessPoint::ACCESS_POINT_MANAGE_CARDS_BUBBLE); if (AccountConsistencyModeManager::IsDiceEnabledForProfile(profile)) { #if BUILDFLAG(ENABLE_DICE_SUPPORT) - promo_view = new DiceBubbleSyncPromoView( + footnote_view_ = new DiceBubbleSyncPromoView( profile, sync_promo_delegate_.get(), signin_metrics::AccessPoint::ACCESS_POINT_MANAGE_CARDS_BUBBLE, IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE, IDS_AUTOFILL_SYNC_PROMO_MESSAGE, @@ -53,15 +53,15 @@ NOTREACHED(); #endif } else { - promo_view = new BubbleSyncPromoView( + footnote_view_ = new BubbleSyncPromoView( sync_promo_delegate_.get(), signin_metrics::AccessPoint::ACCESS_POINT_MANAGE_CARDS_BUBBLE, IDS_AUTOFILL_SIGNIN_PROMO_LINK_DICE_DISABLED, IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE_DICE_DISABLED); } - InitFootnoteView(promo_view); - return promo_view; + SetFootnoteViewForTesting(footnote_view_); + return footnote_view_; } views::View* SaveCardManageCardsBubbleViews::CreateExtraView() {
diff --git a/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.cc b/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.cc index d7a89ab..78c721ba 100644 --- a/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.cc +++ b/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.cc
@@ -4,8 +4,6 @@ #include "chrome/browser/ui/views/autofill/save_card_offer_bubble_views.h" -#include <memory> - #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/app/vector_icons/vector_icons.h" @@ -58,11 +56,12 @@ if (controller()->GetLegalMessageLines().empty()) return nullptr; - legal_message_view_ = + footnote_view_ = new LegalMessageView(controller()->GetLegalMessageLines(), this); + footnote_view_->set_id(DialogViewId::FOOTNOTE_VIEW); - InitFootnoteView(legal_message_view_); - return legal_message_view_; + SetFootnoteViewForTesting(footnote_view_); + return footnote_view_; } bool SaveCardOfferBubbleViews::Accept() { @@ -102,7 +101,7 @@ if (!controller()) return; - legal_message_view_->OnLinkClicked(label, range, web_contents_); + footnote_view_->OnLinkClicked(label, range, web_contents_); } void SaveCardOfferBubbleViews::ContentsChanged(
diff --git a/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.h b/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.h index fe71f2ec..b68ee32 100644 --- a/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.h +++ b/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.h
@@ -55,7 +55,7 @@ views::Textfield* cardholder_name_textfield_ = nullptr; - LegalMessageView* legal_message_view_ = nullptr; + LegalMessageView* footnote_view_ = nullptr; DISALLOW_COPY_AND_ASSIGN(SaveCardOfferBubbleViews); };
diff --git a/chrome/browser/ui/views/autofill/save_card_sign_in_promo_bubble_views.cc b/chrome/browser/ui/views/autofill/save_card_sign_in_promo_bubble_views.cc index 2ddd989..8efd4143 100644 --- a/chrome/browser/ui/views/autofill/save_card_sign_in_promo_bubble_views.cc +++ b/chrome/browser/ui/views/autofill/save_card_sign_in_promo_bubble_views.cc
@@ -48,7 +48,6 @@ provider->GetDistanceMetric(views::DISTANCE_UNRELATED_CONTROL_VERTICAL))); view->set_id(DialogViewId::SIGN_IN_PROMO_VIEW); - std::unique_ptr<views::View> signin_view; Profile* profile = controller()->GetProfile(); sync_promo_delegate_ = std::make_unique<SaveCardSignInPromoBubbleViews::SyncPromoDelegate>( @@ -56,21 +55,19 @@ signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE); if (AccountConsistencyModeManager::IsDiceEnabledForProfile(profile)) { #if BUILDFLAG(ENABLE_DICE_SUPPORT) - signin_view = std::make_unique<DiceBubbleSyncPromoView>( + view->AddChildView(new DiceBubbleSyncPromoView( profile, sync_promo_delegate_.get(), - signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE); + signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE)); #else NOTREACHED(); #endif } else { - signin_view = std::make_unique<BubbleSyncPromoView>( + view->AddChildView(new BubbleSyncPromoView( sync_promo_delegate_.get(), signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE, IDS_AUTOFILL_SIGNIN_PROMO_LINK_DICE_DISABLED, - IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE_DICE_DISABLED); + IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE_DICE_DISABLED)); } - signin_view->set_id(DialogViewId::SIGN_IN_VIEW); - view->AddChildView(signin_view.release()); return view; }
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc index 48ec85b..c49a812 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
@@ -538,10 +538,6 @@ slide_animation_.Reset(show_label); } -void IconLabelBubbleView::ReduceAnimationTimeForTesting() { - slide_animation_.SetSlideDuration(1); -} - void IconLabelBubbleView::PauseAnimation() { if (slide_animation_.is_animating()) { // If the user clicks while we're animating, the bubble arrow will be
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h index c6e9984..7fb9872 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
@@ -185,10 +185,6 @@ // currently paused. bool is_animation_paused() const { return is_animation_paused_; } - // Reduces the slide duration to 1ms such that animation still follows - // through in the code but is short enough that it is essentially skipped. - void ReduceAnimationTimeForTesting(); - private: // Spacing between the image and the label. int GetInternalSpacing() const;
diff --git a/chrome/browser/ui/views/page_action/page_action_icon_view.cc b/chrome/browser/ui/views/page_action/page_action_icon_view.cc index b5df57c..f51d4b9 100644 --- a/chrome/browser/ui/views/page_action/page_action_icon_view.cc +++ b/chrome/browser/ui/views/page_action/page_action_icon_view.cc
@@ -25,6 +25,15 @@ #include "ui/views/controls/focus_ring.h" #include "ui/views/style/platform_style.h" +namespace { + +bool ActivateButtonOnSpaceDown() { + return views::PlatformStyle::kKeyClickActionOnSpace == + views::Button::KeyClickAction::CLICK_ON_KEY_PRESS; +} + +} // namespace + void PageActionIconView::Init() { AddChildView(image()); image()->set_can_process_events_within_subtree(false); @@ -127,15 +136,18 @@ return false; AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr /* &event */); - // As with Button, return activates on key down and space activates on - // key up. - if (event.key_code() == ui::VKEY_RETURN) + // This behavior is duplicated from Button: on some platforms buttons activate + // on VKEY_SPACE keydown, and on some platforms they activate on VKEY_SPACE + // keyup. All platforms activate buttons on VKEY_RETURN keydown though. + if (ActivateButtonOnSpaceDown() || event.key_code() == ui::VKEY_RETURN) ExecuteCommand(EXECUTE_SOURCE_KEYBOARD); return true; } bool PageActionIconView::OnKeyReleased(const ui::KeyEvent& event) { - if (event.key_code() != ui::VKEY_SPACE) + // If buttons activate on VKEY_SPACE keydown, don't re-execute the command on + // keyup. + if (event.key_code() != ui::VKEY_SPACE || ActivateButtonOnSpaceDown()) return false; ExecuteCommand(EXECUTE_SOURCE_KEYBOARD);
diff --git a/chrome/browser/ui/views/page_action/page_action_icon_view.h b/chrome/browser/ui/views/page_action/page_action_icon_view.h index 372b25e..0f6d3411 100644 --- a/chrome/browser/ui/views/page_action/page_action_icon_view.h +++ b/chrome/browser/ui/views/page_action/page_action_icon_view.h
@@ -33,7 +33,7 @@ // Represents an inbuilt (as opposed to an extension) page action icon that // shows a bubble when clicked. -// TODO(spqchan): Convert this to subclass Button. +// TODO(ellyjones): Convert this to subclass Button. class PageActionIconView : public IconLabelBubbleView { public: class Delegate {
diff --git a/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.cc b/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.cc index 38396bf..c1e8a5463 100644 --- a/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.cc +++ b/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.cc
@@ -110,10 +110,6 @@ NOTREACHED(); } -views::View* DiceBubbleSyncPromoView::GetSigninButtonForTesting() { - return signin_button_view_ ? signin_button_view_->signin_button() : nullptr; -} - void DiceBubbleSyncPromoView::EnableSync( bool is_default_promo_account, const base::Optional<AccountInfo>& account) {
diff --git a/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.h b/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.h index 1d8ff96..187f519 100644 --- a/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.h +++ b/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.h
@@ -52,9 +52,6 @@ // views::ButtonListener: void ButtonPressed(views::Button* sender, const ui::Event& event) override; - // Returns the sign-in button. - views::View* GetSigninButtonForTesting(); - private: // Used to enable sync in the DiceAccountsMenu and when |signin_button_| is // pressed.
diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index df7517b..81841eb 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc
@@ -76,8 +76,14 @@ #endif #if defined(OS_CHROMEOS) +#include <map> + +#include "base/stl_util.h" +#include "base/strings/strcat.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chrome/browser/chromeos/customization/customization_document.h" +#include "chromeos/system/statistics_provider.h" +#include "components/language/core/common/locale_util.h" #endif using content::BrowserThread; @@ -92,16 +98,80 @@ constexpr char kKeyboardUtilsPath[] = "keyboard_utils.js"; -// Loads bundled Eula contents. The online version of Eula is fetched in Eula -// screen javascript. This is intentional because chrome://terms runs in a -// privileged webui context and should never load from untrusted places. +// APAC region name. +constexpr char kApac[] = "apac"; +// EMEA region name. +constexpr char kEmea[] = "emea"; +// EU region name. +constexpr char kEu[] = "eu"; + +// List of countries that belong to APAC. +const char* const kApacCountries[] = {"au", "bd", "cn", "hk", "id", "in", "jp", + "kh", "la", "lk", "mm", "mn", "my", "nz", + "np", "ph", "sg", "th", "tw", "vn"}; + +// List of countries that belong to EMEA. +const char* const kEmeaCountries[] = {"na", "za", "am", "az", "ch", "eg", "ge", + "il", "is", "ke", "kg", "li", "mk", "no", + "rs", "ru", "tr", "tz", "ua", "ug", "za"}; + +// List of countries that belong to EU. +const char* const kEuCountries[] = { + "at", "be", "bg", "cz", "dk", "es", "fi", "fr", "gb", "gr", "hr", "hu", + "ie", "it", "lt", "lu", "lv", "nl", "pl", "pt", "ro", "se", "si", "sk"}; + +// Maps country to one of 3 regions: APAC, EMEA, EU. +typedef std::map<std::string, std::string> CountryRegionMap; + +// Returns country to region map with EU, EMEA and APAC countries. +CountryRegionMap CreateCountryRegionMap() { + CountryRegionMap region_map; + for (size_t i = 0; i < base::size(kApacCountries); ++i) { + region_map.emplace(kApacCountries[i], kApac); + } + + for (size_t i = 0; i < base::size(kEmeaCountries); ++i) { + region_map.emplace(kEmeaCountries[i], kEmea); + } + + for (size_t i = 0; i < base::size(kEuCountries); ++i) { + region_map.emplace(kEuCountries[i], kEu); + } + return region_map; +} + +// Reads device region from VPD. Returns "us" in case of read or parsing errors. +std::string ReadDeviceRegionFromVpd() { + std::string region = "us"; + chromeos::system::StatisticsProvider* provider = + chromeos::system::StatisticsProvider::GetInstance(); + bool region_found = + provider->GetMachineStatistic(chromeos::system::kRegionKey, ®ion); + if (region_found) { + // We only need the first part of the complex region codes like ca.ansi. + std::vector<std::string> region_pieces = base::SplitString( + region, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + if (!region_pieces.empty()) + region = region_pieces[0]; + } else { + LOG(WARNING) << "Device region for Play Store ToS not found in VPD - " + "defaulting to US."; + } + return base::ToLowerASCII(region); +} + +// Loads bundled terms of service contents (Eula, OEM Eula, Play Store Terms). +// The online version of terms is fetched in OOBE screen javascript. This is +// intentional because chrome://terms runs in a privileged webui context and +// should never load from untrusted places. class ChromeOSTermsHandler : public base::RefCountedThreadSafe<ChromeOSTermsHandler> { public: static void Start(const std::string& path, - const content::URLDataSource::GotDataCallback& callback) { + const content::URLDataSource::GotDataCallback& callback, + const base::FilePath& chromeos_assets_path) { scoped_refptr<ChromeOSTermsHandler> handler( - new ChromeOSTermsHandler(path, callback)); + new ChromeOSTermsHandler(path, callback, chromeos_assets_path)); handler->StartOnUIThread(); } @@ -109,12 +179,13 @@ friend class base::RefCountedThreadSafe<ChromeOSTermsHandler>; ChromeOSTermsHandler(const std::string& path, - const content::URLDataSource::GotDataCallback& callback) - : path_(path), - callback_(callback), - // Previously we were using "initial locale" http://crbug.com/145142 - locale_(g_browser_process->GetApplicationLocale()) { - } + const content::URLDataSource::GotDataCallback& callback, + const base::FilePath& chromeos_assets_path) + : path_(path), + callback_(callback), + // Previously we were using "initial locale" http://crbug.com/145142 + locale_(g_browser_process->GetApplicationLocale()), + chromeos_assets_path_(chromeos_assets_path) {} virtual ~ChromeOSTermsHandler() {} @@ -126,6 +197,12 @@ FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, base::BindOnce(&ChromeOSTermsHandler::LoadOemEulaFileAsync, this), base::BindOnce(&ChromeOSTermsHandler::ResponseOnUIThread, this)); + } else if (path_ == chrome::kArcTermsURLPath) { + // Load ARC++ terms from the file. + base::PostTaskWithTraitsAndReply( + FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, + base::BindOnce(&ChromeOSTermsHandler::LoadArcTermsFileAsync, this), + base::BindOnce(&ChromeOSTermsHandler::ResponseOnUIThread, this)); } else { // Load local ChromeOS terms from the file. base::PostTaskWithTraitsAndReply( @@ -170,11 +247,54 @@ } } + void LoadArcTermsFileAsync() { + base::ScopedBlockingCall scoped_blocking_call( + base::BlockingType::MAY_BLOCK); + + const CountryRegionMap kCountryRegionMap = CreateCountryRegionMap(); + const std::string kDeviceRegion = ReadDeviceRegionFromVpd(); + // To determine version of Play Store ToS: + // * try to match language and device region combination + // * if not found check the mapping to default region (APAC, EMEA, EU) + // * if no default region mapping default to en-US + // Note: AMERICAS region defaults to en-US and to simplify it is not + // included in the country region map. + const std::string locale_region = base::StrCat( + {base::ToLowerASCII(language::ExtractBaseLanguage(locale_)), "-", + kDeviceRegion}); + if (base::ReadFileToString(CreateArcTermsPath(locale_region), &contents_)) + return; + + const auto region = kCountryRegionMap.find(kDeviceRegion); + if (region != kCountryRegionMap.end()) { + LOG(WARNING) << "Could not find offline Play Store ToS for: " + << locale_region << ". Trying by region: " << region->second; + if (base::ReadFileToString(CreateArcTermsPath(region->second.c_str()), + &contents_)) { + return; + } + } + + LOG(WARNING) << "Could not find offline Play Store ToS by locale nor " + "region for: " + << locale_region << ". Loading: en-US"; + if (base::ReadFileToString(CreateArcTermsPath("en-us"), &contents_)) + return; + + LOG(ERROR) << "Failed to load offline Play Store ToS"; + contents_.clear(); + } + + base::FilePath CreateArcTermsPath(const std::string& locale) const { + return chromeos_assets_path_.Append( + base::StringPrintf(chrome::kArcTermsPathFormat, locale.c_str())); + } + void ResponseOnUIThread() { DCHECK_CURRENTLY_ON(BrowserThread::UI); // If we fail to load Chrome OS EULA from disk, load it from resources. - // Do nothing if OEM EULA load failed. - if (contents_.empty() && path_ != chrome::kOemEulaURLPath) + // Do nothing if OEM EULA or Play Store ToS load failed. + if (contents_.empty() && path_.empty()) contents_ = l10n_util::GetStringUTF8(IDS_TERMS_HTML); callback_.Run(base::RefCountedString::TakeString(&contents_)); } @@ -188,6 +308,9 @@ // Locale of the EULA. const std::string locale_; + // Path to Chrome OS assets. + const base::FilePath chromeos_assets_path_; + // EULA contents that was loaded from file. std::string contents_; @@ -463,7 +586,10 @@ #if !defined(OS_ANDROID) } else if (source_name_ == chrome::kChromeUITermsHost) { #if defined(OS_CHROMEOS) - ChromeOSTermsHandler::Start(path, callback); + std::string assets_dir = chromeos_assets_dir_for_tests_.empty() + ? chrome::kChromeOSAssetPath + : chromeos_assets_dir_for_tests_; + ChromeOSTermsHandler::Start(path, callback, base::FilePath(assets_dir)); return; #else response = l10n_util::GetStringUTF8(IDS_TERMS_HTML);
diff --git a/chrome/browser/ui/webui/about_ui.h b/chrome/browser/ui/webui/about_ui.h index 801b98e..a13d684 100644 --- a/chrome/browser/ui/webui/about_ui.h +++ b/chrome/browser/ui/webui/about_ui.h
@@ -40,10 +40,19 @@ Profile* profile() { return profile_; } + // Overrides Chrome OS assets location for tests. + void SetChromeOSAssetsDirForTests(const std::string& path) { + chromeos_assets_dir_for_tests_ = path; + } + private: std::string source_name_; Profile* profile_; + // Directory to be used as Chrome OS assets location in tests. If set, it + // overrides chrome::kChromeOSAssetPath. + std::string chromeos_assets_dir_for_tests_; + DISALLOW_COPY_AND_ASSIGN(AboutUIHTMLSource); };
diff --git a/chrome/browser/ui/webui/about_ui_unittest.cc b/chrome/browser/ui/webui/about_ui_unittest.cc new file mode 100644 index 0000000..951b965f --- /dev/null +++ b/chrome/browser/ui/webui/about_ui_unittest.cc
@@ -0,0 +1,320 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/webui/about_ui.h" + +#include <memory> +#include <string> + +#include "base/bind.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/files/scoped_temp_dir.h" +#include "base/macros.h" +#include "base/memory/ref_counted_memory.h" +#include "base/strings/string_piece.h" +#include "base/strings/string_util.h" +#include "base/task/post_task.h" +#include "base/test/scoped_task_environment.h" +#include "chrome/common/url_constants.h" +#include "chrome/common/webui_url_constants.h" +#include "chrome/test/base/scoped_browser_locale.h" +#include "chromeos/system/fake_statistics_provider.h" +#include "chromeos/system/statistics_provider.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/resource_request_info.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +class TestDataReceiver { + public: + TestDataReceiver() = default; + virtual ~TestDataReceiver() = default; + + bool data_received() const { return data_received_; } + + std::string data() const { return data_; } + + void OnDataReceived(scoped_refptr<base::RefCountedMemory> bytes) { + data_received_ = true; + data_ = base::StringPiece(reinterpret_cast<const char*>(bytes->front()), + bytes->size()) + .as_string(); + } + + private: + bool data_received_ = false; + std::string data_; + + DISALLOW_COPY_AND_ASSIGN(TestDataReceiver); +}; + +} // namespace + +class ChromeOSTermsTest : public testing::Test { + protected: + ChromeOSTermsTest() + : scoped_task_environment_( + base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + ~ChromeOSTermsTest() override = default; + + void SetUp() override { + // Create root tmp directory for fake ARC ToS data. + base::FilePath root_path; + base::CreateNewTempDirectory(FILE_PATH_LITERAL(""), &root_path); + ASSERT_TRUE(root_dir_.Set(root_path)); + arc_tos_dir_ = root_dir_.GetPath().Append("arc_tos"); + ASSERT_TRUE(base::CreateDirectory(arc_tos_dir_)); + + tested_html_source_ = std::make_unique<AboutUIHTMLSource>( + chrome::kChromeUITermsHost, nullptr); + tested_html_source_->SetChromeOSAssetsDirForTests( + root_dir_.GetPath().value()); + } + + // Creates directory for the given |locale| that contains terms.html. Writes + // the |locale| string to the created file. + bool CreateTermsForLocale(const std::string& locale) { + base::FilePath dir = arc_tos_dir_.Append(base::ToLowerASCII(locale)); + if (!base::CreateDirectory(dir)) + return false; + + if (base::WriteFile(dir.AppendASCII("terms.html"), locale.c_str(), + locale.length()) != static_cast<int>(locale.length())) { + return false; + } + return true; + } + + // Sets device region in VPD. + void SetRegion(const std::string& region) { + statistics_provider_.SetMachineStatistic(chromeos::system::kRegionKey, + region); + } + + // Starts data request. + void StartRequest(TestDataReceiver* data_receiver) { + content::ResourceRequestInfo::WebContentsGetter wc_getter; + tested_html_source_->StartDataRequest( + chrome::kArcTermsURLPath, std::move(wc_getter), + base::BindRepeating(&TestDataReceiver::OnDataReceived, + base::Unretained(data_receiver))); + scoped_task_environment_.RunUntilIdle(); + } + + private: + base::ScopedTempDir root_dir_; + base::FilePath arc_tos_dir_; + + base::test::ScopedTaskEnvironment scoped_task_environment_; + content::TestBrowserThreadBundle test_browser_thread_bundle_; + + chromeos::system::ScopedFakeStatisticsProvider statistics_provider_; + + std::unique_ptr<AboutUIHTMLSource> tested_html_source_; + + DISALLOW_COPY_AND_ASSIGN(ChromeOSTermsTest); +}; + +TEST_F(ChromeOSTermsTest, NoData) { + SetRegion("ca"); + ScopedBrowserLocale browser_locale("en-CA"); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("", data_receiver.data()); +} + +class DemoModeChromeOSTermsTest : public ChromeOSTermsTest { + protected: + DemoModeChromeOSTermsTest() = default; + ~DemoModeChromeOSTermsTest() override = default; + + void SetUp() override { + ChromeOSTermsTest::SetUp(); + AddDemoModeLocale(); + } + + // Adds locales supported by demo mode. + void AddDemoModeLocale() { + ASSERT_TRUE(CreateTermsForLocale("apac")); + ASSERT_TRUE(CreateTermsForLocale("da-DK")); + ASSERT_TRUE(CreateTermsForLocale("de-de")); + ASSERT_TRUE(CreateTermsForLocale("emea")); + ASSERT_TRUE(CreateTermsForLocale("en-CA")); + ASSERT_TRUE(CreateTermsForLocale("en-GB")); + ASSERT_TRUE(CreateTermsForLocale("en-IE")); + ASSERT_TRUE(CreateTermsForLocale("en-US")); + ASSERT_TRUE(CreateTermsForLocale("eu")); + ASSERT_TRUE(CreateTermsForLocale("fi-FI")); + ASSERT_TRUE(CreateTermsForLocale("fr-BE")); + ASSERT_TRUE(CreateTermsForLocale("fr-CA")); + ASSERT_TRUE(CreateTermsForLocale("fr-FR")); + ASSERT_TRUE(CreateTermsForLocale("ko-KR")); + ASSERT_TRUE(CreateTermsForLocale("nb-NO")); + ASSERT_TRUE(CreateTermsForLocale("nl-BE")); + ASSERT_TRUE(CreateTermsForLocale("nl-NL")); + ASSERT_TRUE(CreateTermsForLocale("sv-SE")); + } + + private: + DISALLOW_COPY_AND_ASSIGN(DemoModeChromeOSTermsTest); +}; + +TEST_F(DemoModeChromeOSTermsTest, SimpleRegion) { + SetRegion("ca"); + for (const char* locale : {"en-CA", "fr-CA"}) { + ScopedBrowserLocale browser_locale(locale); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ(locale, data_receiver.data()); + } +} + +TEST_F(DemoModeChromeOSTermsTest, ComplexRegion) { + const std::string kLocale = "en-CA"; + ScopedBrowserLocale browser_locale(kLocale); + for (const char* region : + {"ca.hybridansi", "ca.ansi", "ca.multix", "ca.fr"}) { + SetRegion(region); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ(kLocale, data_receiver.data()); + } +} + +TEST_F(DemoModeChromeOSTermsTest, NotCaseSensitive) { + SetRegion("CA"); + for (const char* locale : {"EN-CA", "en-CA", "EN-ca"}) { + ScopedBrowserLocale browser_locale(locale); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("en-CA", data_receiver.data()); + } +} + +TEST_F(DemoModeChromeOSTermsTest, DefaultToEuRegion) { + const std::string kLocale = "pl-PL"; + ScopedBrowserLocale browser_locale(kLocale); + SetRegion("pl"); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("eu", data_receiver.data()); +} + +TEST_F(DemoModeChromeOSTermsTest, DefaultToEmeaRegion) { + const std::string kLocale = "fr-CH"; + ScopedBrowserLocale browser_locale(kLocale); + SetRegion("ch"); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("emea", data_receiver.data()); +} + +TEST_F(DemoModeChromeOSTermsTest, DefaultToApacRegion) { + const std::string kLocale = "en-PH"; + ScopedBrowserLocale browser_locale(kLocale); + SetRegion("ph"); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("apac", data_receiver.data()); +} + +TEST_F(DemoModeChromeOSTermsTest, DefaultToAmericasRegion) { + const std::string kLocale = "en-MX"; + ScopedBrowserLocale browser_locale(kLocale); + SetRegion("mx"); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("en-US", data_receiver.data()); +} + +TEST_F(DemoModeChromeOSTermsTest, DefaultToEnUs) { + const std::string kLocale = "en-SA"; + ScopedBrowserLocale browser_locale(kLocale); + SetRegion("sa"); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("en-US", data_receiver.data()); +} + +TEST_F(DemoModeChromeOSTermsTest, NoLangCountryCombination) { + SetRegion("be"); + { + const std::string kLocale = "nl-BE"; + ScopedBrowserLocale browser_locale(kLocale); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ(kLocale, data_receiver.data()); + } + { + const std::string kLocale = "de-BE"; + ScopedBrowserLocale browser_locale(kLocale); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + // No language - country combination - defaults to region. + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("eu", data_receiver.data()); + } +} + +TEST_F(DemoModeChromeOSTermsTest, InvalidRegion) { + const std::string kLocale = "da-DK"; + ScopedBrowserLocale browser_locale(kLocale); + for (const char* region : {"", " ", ".", "..", "-", "xyz"}) { + SetRegion(region); + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("en-US", data_receiver.data()); + } +} + +TEST_F(DemoModeChromeOSTermsTest, InvalidLocale) { + SetRegion("se"); + for (const char* locale : {"", " ", ".", "-", "-sv"}) { + ScopedBrowserLocale browser_locale(locale); + + TestDataReceiver data_receiver; + StartRequest(&data_receiver); + + EXPECT_TRUE(data_receiver.data_received()); + EXPECT_EQ("eu", data_receiver.data()); + } +}
diff --git a/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc index 8b3d420b..f1d7e7e 100644 --- a/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc
@@ -246,6 +246,8 @@ Profile* profile = ProfileManager::GetActiveUserProfile(); CHECK(profile); + CallJS("clearDemoMode"); + // Enable ARC to match ArcSessionManager logic. ArcSessionManager expects that // ARC is enabled (prefs::kArcEnabled = true) on showing Terms of Service. If // user accepts ToS then prefs::kArcEnabled is left activated. If user skips
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index fb0d464..84859e4 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -1143,32 +1143,29 @@ const std::string& callback_id, const std::string& printer_name, std::unique_ptr<base::DictionaryValue> destination_info) { - auto response = std::make_unique<base::DictionaryValue>(); - bool success = true; - auto caps_value = std::make_unique<base::Value>(); - auto caps = std::make_unique<base::DictionaryValue>(); - if (destination_info && - destination_info->Remove(printing::kSettingCapabilities, &caps_value) && - caps_value->is_dict()) { - caps = base::DictionaryValue::From(std::move(caps_value)); + base::DictionaryValue response; + base::Value* caps_value = + destination_info + ? destination_info->FindKeyOfType(printing::kSettingCapabilities, + base::Value::Type::DICTIONARY) + : nullptr; + response.SetString("printerId", printer_name); + response.SetBoolean("success", !!caps_value); + response.SetKey("capabilities", caps_value ? std::move(*caps_value) + : base::DictionaryValue()); + if (caps_value) { base::Value* printer = destination_info->FindKeyOfType( printing::kPrinter, base::Value::Type::DICTIONARY); if (printer) { base::Value* policies_value = printer->FindKeyOfType( printing::kSettingPolicies, base::Value::Type::DICTIONARY); if (policies_value) - response->SetKey("policies", std::move(*policies_value)); + response.SetKey("policies", std::move(*policies_value)); } } else { LOG(WARNING) << "Printer setup failed"; - success = false; } - - response->SetString("printerId", printer_name); - response->SetBoolean("success", success); - response->Set("capabilities", std::move(caps)); - - ResolveJavascriptCallback(base::Value(callback_id), *response); + ResolveJavascriptCallback(base::Value(callback_id), response); } void PrintPreviewHandler::SendCloudPrintEnabled() {
diff --git a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc index 4ffdf6b8..c7852d3 100644 --- a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
@@ -840,6 +840,8 @@ IDS_SETTINGS_DOWNLOADS_SHARE_ADDED_UNSUPPORTED_DEVICE_MESSAGE}, {"smbShareAddedMountExistsMessage", IDS_SETTINGS_DOWNLOADS_SHARE_ADDED_MOUNT_EXISTS_MESSAGE}, + {"smbShareAddedInvalidURLMessage", + IDS_SETTINGS_DOWNLOADS_SHARE_ADDED_MOUNT_INVALID_URL_MESSAGE}, #endif }; AddLocalizedStringsBulk(html_source, localized_strings,
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index befbbb6a..b6d16de6 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -2590,4 +2590,9 @@ // (throttling/freezing/discarding) are enabled. const char kTabLifecyclesEnabled[] = "tab_lifecycles_enabled"; +// Boolean that enables the Enterprise Hardware Platform Extension API for +// extensions installed by enterprise policy. +const char kEnterpriseHardwarePlatformAPIEnabled[] = + "enterprise_hardware_platform_api.enabled"; + } // namespace prefs
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 361a8cd..d8ffbc0 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -907,6 +907,8 @@ extern const char kTabLifecyclesEnabled[]; +extern const char kEnterpriseHardwarePlatformAPIEnabled[]; + } // namespace prefs #endif // CHROME_COMMON_PREF_NAMES_H_
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 53800dc..84842846 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc
@@ -269,6 +269,8 @@ const char kEULAPathFormat[] = "/usr/share/chromeos-assets/eula/%s/eula.html"; +const char kArcTermsPathFormat[] = "arc_tos/%s/terms.html"; + const char kEolNotificationURL[] = "https://www.google.com/chromebook/older/"; const char kGoogleNameserversLearnMoreURL[] = @@ -300,6 +302,8 @@ const char kOemEulaURLPath[] = "oem"; +const char kArcTermsURLPath[] = "arc"; + const char kOnlineEulaURLPath[] = "https://www.google.com/intl/%s/chrome/eula_text.html";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 452cf33..966f9d36 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h
@@ -216,8 +216,13 @@ // The URL for the "Learn more" link the the Easy Unlock settings. extern const char kEasyUnlockLearnMoreUrl[]; +// The path to the offline Chrome OS EULA. extern const char kEULAPathFormat[]; +// The path format to the localized offline ARC++ Terms of Service. +// Relative to |kChromeOSAssetPath|. +extern const char kArcTermsPathFormat[]; + // The URL for EOL notification extern const char kEolNotificationURL[]; @@ -248,8 +253,12 @@ // The URL for the "Learn more" link for natural scrolling on ChromeOS. extern const char kNaturalScrollHelpURL[]; +// The URL path to offline OEM EULA. extern const char kOemEulaURLPath[]; +// THE URL path to offline ARC++ Terms of Service. +extern const char kArcTermsURLPath[]; + extern const char kOnlineEulaURLPath[]; // The URL for the "learn more" link for TPM firmware update.
diff --git a/chrome/installer/gcapi/DEPS b/chrome/installer/gcapi/DEPS index bdbe2d5..ce04d6f 100644 --- a/chrome/installer/gcapi/DEPS +++ b/chrome/installer/gcapi/DEPS
@@ -3,7 +3,7 @@ "-chrome", "+chrome/installer/gcapi", "+chrome/installer/launcher_support", - # Take care not to allow any dependence on BrowserDistribution. + # Take care not to allow any dependence beyond constants. "+chrome/installer/util/google_update_constants.h", "+chrome/installer/util/util_constants.h", ]
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 4dc9bf0..bb3d25f 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc
@@ -336,7 +336,6 @@ } void CreateOrUpdateShortcuts(const base::FilePath& target, - const Product& product, const MasterPreferences& prefs, InstallShortcutLevel install_level, InstallShortcutOperation install_operation) { @@ -429,7 +428,6 @@ } void RegisterChromeOnMachine(const InstallerState& installer_state, - const Product& product, bool make_chrome_default, const base::Version& version) { // Try to add Chrome to Media Player shim inclusion list. We don't do any @@ -505,7 +503,6 @@ installer_state.SetStage(CREATING_SHORTCUTS); // Creates shortcuts for Chrome. - const Product& chrome_product = installer_state.product(); const base::FilePath chrome_exe( installer_state.target_path().Append(kChromeExe)); @@ -525,7 +522,7 @@ install_operation = INSTALL_SHORTCUT_CREATE_ALL; } - CreateOrUpdateShortcuts(chrome_exe, chrome_product, prefs, install_level, + CreateOrUpdateShortcuts(chrome_exe, prefs, install_level, install_operation); // Register Chrome and, if requested, make Chrome the default browser. @@ -546,8 +543,8 @@ } RegisterChromeOnMachine( - installer_state, chrome_product, - make_chrome_default || force_chrome_default_for_user, new_version); + installer_state, make_chrome_default || force_chrome_default_for_user, + new_version); if (!installer_state.system_install()) { UpdateDefaultBrowserBeaconForPath( @@ -599,7 +596,6 @@ } void HandleOsUpgradeForBrowser(const InstallerState& installer_state, - const Product& chrome, const base::Version& installed_version) { VLOG(1) << "Updating and registering shortcuts for --on-os-upgrade."; @@ -613,11 +609,11 @@ installer_state.system_install() ? ALL_USERS : CURRENT_USER; const base::FilePath chrome_exe( installer_state.target_path().Append(kChromeExe)); - CreateOrUpdateShortcuts(chrome_exe, chrome, prefs, level, + CreateOrUpdateShortcuts(chrome_exe, prefs, level, INSTALL_SHORTCUT_REPLACE_EXISTING); // Adapt Chrome registrations to this new OS. - RegisterChromeOnMachine(installer_state, chrome, false, installed_version); + RegisterChromeOnMachine(installer_state, false, installed_version); // Active Setup registrations are sometimes lost across OS update, make sure // they're back in place. Note: when Active Setup registrations in HKLM are @@ -628,7 +624,7 @@ // something between InstallOrUpdateProduct and AddActiveSetupWorkItems, but // this takes care of what is most required for now). std::unique_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList()); - AddActiveSetupWorkItems(installer_state, installed_version, chrome, + AddActiveSetupWorkItems(installer_state, installed_version, work_item_list.get()); if (!work_item_list->Do()) { LOG(WARNING) << "Failed to reinstall Active Setup keys."; @@ -664,8 +660,7 @@ cleanup_list->set_log_message("Cleanup deprecated per-user registrations"); cleanup_list->set_rollback_enabled(false); cleanup_list->set_best_effort(true); - AddCleanupDeprecatedPerUserRegistrationsWorkItems(installer_state.product(), - cleanup_list.get()); + AddCleanupDeprecatedPerUserRegistrationsWorkItems(cleanup_list.get()); cleanup_list->Do(); // Only create shortcuts on Active Setup if the first run sentinel is not @@ -685,8 +680,7 @@ const base::FilePath installation_root = installer_state.target_path(); MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); base::FilePath chrome_exe(installation_root.Append(kChromeExe)); - CreateOrUpdateShortcuts(chrome_exe, installer_state.product(), prefs, - CURRENT_USER, install_operation); + CreateOrUpdateShortcuts(chrome_exe, prefs, CURRENT_USER, install_operation); UpdateDefaultBrowserBeaconForPath(chrome_exe);
diff --git a/chrome/installer/setup/install.h b/chrome/installer/setup/install.h index b2512bc..1609fc3 100644 --- a/chrome/installer/setup/install.h +++ b/chrome/installer/setup/install.h
@@ -20,7 +20,6 @@ class InstallationState; class InstallerState; class MasterPreferences; -class Product; enum InstallShortcutOperation { // Create all shortcuts (potentially skipping those explicitly stated not to @@ -64,7 +63,6 @@ // taskbar. void CreateOrUpdateShortcuts( const base::FilePath& target, - const Product& product, const MasterPreferences& prefs, InstallShortcutLevel install_level, InstallShortcutOperation install_operation); @@ -74,7 +72,6 @@ // requires no more user interaction than a UAC prompt. In practice, this means // on versions of Windows prior to Windows 8. void RegisterChromeOnMachine(const InstallerState& installer_state, - const Product& product, bool make_chrome_default); // This function installs or updates a new version of Chrome. It returns @@ -115,7 +112,6 @@ // |chrome| The installed product (must be a browser). // |installed_version| the current version of this install. void HandleOsUpgradeForBrowser(const InstallerState& installer_state, - const Product& chrome, const base::Version& installed_version); // Performs per-user installation-related tasks on Active Setup (ran on first
diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index 1dd4a2a..f74d9d9 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc
@@ -31,13 +31,11 @@ #include "chrome/installer/setup/install_worker.h" #include "chrome/installer/setup/installer_state.h" #include "chrome/installer/setup/setup_constants.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/master_preferences_constants.h" -#include "chrome/installer/util/product.h" #include "chrome/installer/util/shell_util.h" #include "chrome/installer/util/util_constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -210,10 +208,6 @@ void SetUp() override { EXPECT_EQ(S_OK, CoInitialize(NULL)); - BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - ASSERT_TRUE(dist); - product_.reset(new installer::Product(dist)); - ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); chrome_exe_ = temp_dir_.GetPath().Append(installer::kChromeExe); EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0)); @@ -309,7 +303,6 @@ base::win::ShortcutProperties expected_start_menu_properties_; base::FilePath chrome_exe_; - std::unique_ptr<installer::Product> product_; std::unique_ptr<installer::MasterPreferences> prefs_; base::ScopedTempDir temp_dir_; @@ -358,9 +351,9 @@ } TEST_F(InstallShortcutTest, CreateAllShortcuts) { - installer::CreateOrUpdateShortcuts( - chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, - installer::INSTALL_SHORTCUT_CREATE_ALL); + installer::CreateOrUpdateShortcuts(chrome_exe_, *prefs_, + installer::CURRENT_USER, + installer::INSTALL_SHORTCUT_CREATE_ALL); base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); base::win::ValidateShortcut(user_quick_launch_shortcut_, expected_properties_); @@ -369,9 +362,8 @@ } TEST_F(InstallShortcutTest, CreateAllShortcutsSystemLevel) { - installer::CreateOrUpdateShortcuts( - chrome_exe_, *product_, *prefs_, installer::ALL_USERS, - installer::INSTALL_SHORTCUT_CREATE_ALL); + installer::CreateOrUpdateShortcuts(chrome_exe_, *prefs_, installer::ALL_USERS, + installer::INSTALL_SHORTCUT_CREATE_ALL); base::win::ValidateShortcut(system_desktop_shortcut_, expected_properties_); base::win::ValidateShortcut(system_start_menu_shortcut_, expected_start_menu_properties_); @@ -384,9 +376,9 @@ TEST_F(InstallShortcutTest, CreateAllShortcutsButDesktopShortcut) { std::unique_ptr<installer::MasterPreferences> prefs_no_desktop( GetFakeMasterPrefs(true, false)); - installer::CreateOrUpdateShortcuts( - chrome_exe_, *product_, *prefs_no_desktop, installer::CURRENT_USER, - installer::INSTALL_SHORTCUT_CREATE_ALL); + installer::CreateOrUpdateShortcuts(chrome_exe_, *prefs_no_desktop, + installer::CURRENT_USER, + installer::INSTALL_SHORTCUT_CREATE_ALL); ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); base::win::ValidateShortcut(user_quick_launch_shortcut_, expected_properties_); @@ -397,9 +389,9 @@ TEST_F(InstallShortcutTest, CreateAllShortcutsButQuickLaunchShortcut) { std::unique_ptr<installer::MasterPreferences> prefs_no_ql( GetFakeMasterPrefs(false, true)); - installer::CreateOrUpdateShortcuts( - chrome_exe_, *product_, *prefs_no_ql, installer::CURRENT_USER, - installer::INSTALL_SHORTCUT_CREATE_ALL); + installer::CreateOrUpdateShortcuts(chrome_exe_, *prefs_no_ql, + installer::CURRENT_USER, + installer::INSTALL_SHORTCUT_CREATE_ALL); base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); base::win::ValidateShortcut(user_start_menu_shortcut_, @@ -428,7 +420,7 @@ base::win::SHORTCUT_CREATE_ALWAYS)); installer::CreateOrUpdateShortcuts( - chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, + chrome_exe_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_REPLACE_EXISTING); base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); base::win::ValidateShortcut(user_quick_launch_shortcut_, @@ -453,7 +445,7 @@ ASSERT_TRUE(base::CreateDirectory(user_start_menu_shortcut_.DirName())); installer::CreateOrUpdateShortcuts( - chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, + chrome_exe_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_REPLACE_EXISTING); base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); @@ -505,8 +497,8 @@ ASSERT_TRUE(base::PathExists(start_menu_subdir_shortcut)); ASSERT_FALSE(base::PathExists(start_menu_shortcut)); - installer::CreateOrUpdateShortcuts(chrome_exe_, *product_, *prefs_, - shortcut_level_, shortcut_operation_); + installer::CreateOrUpdateShortcuts(chrome_exe_, *prefs_, shortcut_level_, + shortcut_operation_); ASSERT_FALSE(base::PathExists(start_menu_subdir_shortcut)); ASSERT_TRUE(base::PathExists(start_menu_shortcut)); } @@ -541,7 +533,7 @@ base::win::SHORTCUT_CREATE_ALWAYS)); installer::CreateOrUpdateShortcuts( - chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, + chrome_exe_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); ASSERT_FALSE(base::PathExists(user_start_menu_shortcut_)); @@ -552,7 +544,7 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelNoSystemShortcutsExist) { installer::CreateOrUpdateShortcuts( - chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, + chrome_exe_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); base::win::ValidateShortcut(user_quick_launch_shortcut_, @@ -573,7 +565,7 @@ base::win::SHORTCUT_CREATE_ALWAYS)); installer::CreateOrUpdateShortcuts( - chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, + chrome_exe_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); base::win::ValidateShortcut(user_quick_launch_shortcut_,
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index 22b8f25..b837e1b 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc
@@ -40,8 +40,6 @@ #include "chrome/installer/setup/setup_constants.h" #include "chrome/installer/setup/setup_util.h" #include "chrome/installer/setup/update_active_setup_version_work_item.h" -#include "chrome/installer/util/app_registration_data.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/callback_work_item.h" #include "chrome/installer/util/conditional_work_item_list.h" #include "chrome/installer/util/create_reg_key_work_item.h" @@ -51,11 +49,8 @@ #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/installation_state.h" #include "chrome/installer/util/l10n_string_util.h" -#include "chrome/installer/util/non_updating_app_registration_data.h" -#include "chrome/installer/util/product.h" #include "chrome/installer/util/set_reg_value_work_item.h" #include "chrome/installer/util/shell_util.h" -#include "chrome/installer/util/updating_app_registration_data.h" #include "chrome/installer/util/util_constants.h" #include "chrome/installer/util/work_item_list.h" @@ -205,15 +200,11 @@ // Add/Remove programs dialog). void AddDeleteUninstallEntryForMSIWorkItems( const InstallerState& installer_state, - const Product& product, WorkItemList* work_item_list) { DCHECK(installer_state.is_msi()) << "This must only be called for MSI installations!"; HKEY reg_root = installer_state.root_key(); - // Assert that this is only called with the one relevant distribution. - // TODO(grt): Remove this when BrowserDistribution goes away. - DCHECK_EQ(BrowserDistribution::GetDistribution(), product.distribution()); base::string16 uninstall_reg = install_static::GetUninstallRegistryPath(); WorkItem* delete_reg_key = work_item_list->AddDeleteRegKeyWorkItem( @@ -418,16 +409,14 @@ google_update::kRegUsageStatsField); } - BrowserDistribution* chrome_dist = installer_state.product().distribution(); - google_update::Tristate consent = GoogleUpdateSettings::GetCollectStatsConsentForBinaries(); if (consent == google_update::TRISTATE_NONE) { VLOG(1) << "No consent value found to migrate to single-install."; // Delete any stale value in Chrome's ClientState key. install_list->AddDeleteRegValueWorkItem( - installer_state.root_key(), chrome_dist->GetStateKey(), KEY_WOW64_64KEY, - google_update::kRegUsageStatsField); + installer_state.root_key(), install_static::GetClientStateKeyPath(), + KEY_WOW64_64KEY, google_update::kRegUsageStatsField); return; } @@ -435,8 +424,9 @@ // Write consent to Chrome's ClientState key. install_list->AddSetRegValueWorkItem( - installer_state.root_key(), chrome_dist->GetStateKey(), KEY_WOW64_32KEY, - google_update::kRegUsageStatsField, static_cast<DWORD>(consent), true); + installer_state.root_key(), install_static::GetClientStateKeyPath(), + KEY_WOW64_32KEY, google_update::kRegUsageStatsField, + static_cast<DWORD>(consent), true); } } // namespace @@ -447,11 +437,8 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state, const base::FilePath& setup_path, const base::Version& new_version, - const Product& product, WorkItemList* install_list) { HKEY reg_root = installer_state.root_key(); - BrowserDistribution* browser_dist = product.distribution(); - DCHECK(browser_dist); // When we are installed via an MSI, we need to store our uninstall strings // in the Google Update client state key. We do this even for non-MSI @@ -467,10 +454,9 @@ installer_path = installer_path.Append(setup_path.BaseName()); base::CommandLine uninstall_arguments(base::CommandLine::NO_PROGRAM); - AppendUninstallCommandLineFlags(installer_state, product, - &uninstall_arguments); + AppendUninstallCommandLineFlags(installer_state, &uninstall_arguments); - base::string16 update_state_key(browser_dist->GetStateKey()); + base::string16 update_state_key(install_static::GetClientStateKeyPath()); install_list->AddCreateRegKeyWorkItem( reg_root, update_state_key, KEY_WOW64_32KEY); install_list->AddSetRegValueWorkItem(reg_root, @@ -494,9 +480,6 @@ DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); - // Assert that this is only called with the one relevant distribution. - // TODO(grt): Remove this when BrowserDistribution goes away. - DCHECK_EQ(BrowserDistribution::GetDistribution(), browser_dist); base::string16 uninstall_reg = install_static::GetUninstallRegistryPath(); install_list->AddCreateRegKeyWorkItem( reg_root, uninstall_reg, KEY_WOW64_32KEY); @@ -588,15 +571,15 @@ // Create Version key for a product (if not already present) and sets the new // product version as the last step. void AddVersionKeyWorkItems(HKEY root, - const base::string16& clients_key, - const base::string16& product_name, const base::Version& new_version, bool add_language_identifier, WorkItemList* list) { + const base::string16 clients_key = install_static::GetClientsKeyPath(); list->AddCreateRegKeyWorkItem(root, clients_key, KEY_WOW64_32KEY); list->AddSetRegValueWorkItem(root, clients_key, KEY_WOW64_32KEY, - google_update::kRegNameField, product_name, + google_update::kRegNameField, + InstallUtil::GetDisplayName(), true); // overwrite name also list->AddSetRegValueWorkItem(root, clients_key, KEY_WOW64_32KEY, google_update::kRegOopcrashesField, @@ -641,11 +624,9 @@ return; } - BrowserDistribution* browser_dist = installer_state.product().distribution(); - DCHECK(browser_dist); install_list->AddSetRegValueWorkItem( - installer_state.root_key(), browser_dist->GetStateKey(), KEY_WOW64_32KEY, - google_update::kRegRLZBrandField, new_brand, true); + installer_state.root_key(), install_static::GetClientStateKeyPath(), + KEY_WOW64_32KEY, google_update::kRegRLZBrandField, new_brand, true); } base::string16 GetUpdatedBrandCode(const base::string16& brand_code) { @@ -751,14 +732,12 @@ // If we're told that we're an MSI install, make sure to set the marker // in the client state key so that future updates do the right thing. if (installer_state.is_msi()) { - const Product& product = installer_state.product(); - AddSetMsiMarkerWorkItem(installer_state, product.distribution(), true, - post_install_task_list); + AddSetMsiMarkerWorkItem(installer_state, true, post_install_task_list); // We want MSI installs to take over the Add/Remove Programs entry. Make a // best-effort attempt to delete any entry left over from previous non-MSI // installations for the same type of install (system or per user). - AddDeleteUninstallEntryForMSIWorkItems(installer_state, product, + AddDeleteUninstallEntryForMSIWorkItems(installer_state, post_install_task_list); } @@ -847,23 +826,20 @@ // language may not be related to a given user's runtime language. const bool add_language_identifier = !installer_state.system_install(); - const Product& product = installer_state.product(); AddUninstallShortcutWorkItems(installer_state, setup_path, new_version, - product, install_list); + install_list); - AddVersionKeyWorkItems(root, install_static::GetClientsKeyPath(), - InstallUtil::GetDisplayName(), new_version, - add_language_identifier, install_list); + AddVersionKeyWorkItems(root, new_version, add_language_identifier, + install_list); - AddCleanupDeprecatedPerUserRegistrationsWorkItems(product, install_list); + AddCleanupDeprecatedPerUserRegistrationsWorkItems(install_list); - AddActiveSetupWorkItems(installer_state, new_version, product, install_list); + AddActiveSetupWorkItems(installer_state, new_version, install_list); - AddOsUpgradeWorkItems(installer_state, setup_path, new_version, product, - install_list); + AddOsUpgradeWorkItems(installer_state, setup_path, new_version, install_list); #if defined(GOOGLE_CHROME_BUILD) AddEnterpriseEnrollmentWorkItems(installer_state, setup_path, new_version, - product, install_list); + install_list); #endif AddFirewallRulesWorkItems(installer_state, current_version == nullptr, install_list); @@ -940,27 +916,19 @@ } void AddSetMsiMarkerWorkItem(const InstallerState& installer_state, - BrowserDistribution* dist, bool set, WorkItemList* work_item_list) { DCHECK(work_item_list); DWORD msi_value = set ? 1 : 0; - WorkItem* set_msi_work_item = - work_item_list->AddSetRegValueWorkItem(installer_state.root_key(), - dist->GetStateKey(), - KEY_WOW64_32KEY, - google_update::kRegMSIField, - msi_value, - true); + WorkItem* set_msi_work_item = work_item_list->AddSetRegValueWorkItem( + installer_state.root_key(), install_static::GetClientStateKeyPath(), + KEY_WOW64_32KEY, google_update::kRegMSIField, msi_value, true); DCHECK(set_msi_work_item); set_msi_work_item->set_best_effort(true); set_msi_work_item->set_log_message("Could not write MSI marker!"); } -void AddCleanupDeprecatedPerUserRegistrationsWorkItems(const Product& product, - WorkItemList* list) { - DCHECK_EQ(BrowserDistribution::GetDistribution(), product.distribution()); - +void AddCleanupDeprecatedPerUserRegistrationsWorkItems(WorkItemList* list) { // This cleanup was added in M49. There are still enough active users on M48 // and earlier today (M55 timeframe) to justify keeping this cleanup in-place. // Remove this when that population stops shrinking. @@ -975,7 +943,6 @@ void AddActiveSetupWorkItems(const InstallerState& installer_state, const base::Version& new_version, - const Product& product, WorkItemList* list) { DCHECK(installer_state.operation() != InstallerState::UNINSTALL); @@ -1026,7 +993,6 @@ } void AppendUninstallCommandLineFlags(const InstallerState& installer_state, - const Product& product, base::CommandLine* uninstall_cmd) { DCHECK(uninstall_cmd); @@ -1044,7 +1010,6 @@ void AddOsUpgradeWorkItems(const InstallerState& installer_state, const base::FilePath& setup_path, const base::Version& new_version, - const Product& product, WorkItemList* install_list) { const HKEY root_key = installer_state.root_key(); const base::string16 cmd_key(GetCommandKey(kCmdOnOsUpgrade)); @@ -1076,7 +1041,6 @@ void AddEnterpriseEnrollmentWorkItems(const InstallerState& installer_state, const base::FilePath& setup_path, const base::Version& new_version, - const Product& product, WorkItemList* install_list) { if (!installer_state.system_install()) return;
diff --git a/chrome/installer/setup/install_worker.h b/chrome/installer/setup/install_worker.h index 4266352..223badd0 100644 --- a/chrome/installer/setup/install_worker.h +++ b/chrome/installer/setup/install_worker.h
@@ -8,11 +8,9 @@ #ifndef CHROME_INSTALLER_SETUP_INSTALL_WORKER_H_ #define CHROME_INSTALLER_SETUP_INSTALL_WORKER_H_ -#include <windows.h> - #include "base/strings/string16.h" +#include "base/win/windows_types.h" -class BrowserDistribution; class WorkItemList; namespace base { @@ -25,7 +23,6 @@ class InstallationState; class InstallerState; -class Product; // This method adds work items to create (or update) Chrome uninstall entry in // either the Control Panel->Add/Remove Programs list or in the Omaha client @@ -33,15 +30,12 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state, const base::FilePath& setup_path, const base::Version& new_version, - const Product& product, WorkItemList* install_list); -// Creates Version key for a product (if not already present) and sets the new +// Creates Chrome's Clients key (if not already present) and sets the new // product version as the last step. If |add_language_identifier| is true, the // "lang" value is also set according to the currently selected translation. void AddVersionKeyWorkItems(HKEY root, - const base::string16& version_key, - const base::string16& product_name, const base::Version& new_version, bool add_language_identifier, WorkItemList* list); @@ -74,7 +68,7 @@ WorkItemList* post_install_task_list); // Builds the complete WorkItemList used to build the set of installation steps -// needed to lay down one or more installed products. +// needed to lay down Chrome. // // setup_path: Path to the executable (setup.exe) as it will be copied // to Chrome install folder after install is complete @@ -103,49 +97,41 @@ WorkItemList* list); void AddSetMsiMarkerWorkItem(const InstallerState& installer_state, - BrowserDistribution* dist, bool set, WorkItemList* work_item_list); // Adds work items to cleanup deprecated per-user registrations. -void AddCleanupDeprecatedPerUserRegistrationsWorkItems(const Product& product, - WorkItemList* list); +void AddCleanupDeprecatedPerUserRegistrationsWorkItems(WorkItemList* list); // Adds Active Setup registration for sytem-level setup to be called by Windows -// on user-login post-install/update. -// This method should be called for installation only. -// |product|: The product being installed. This method is a no-op if this is -// anything other than system-level Chrome/Chromium. +// on user-login post-install/update. This method should be called for +// installation only. void AddActiveSetupWorkItems(const InstallerState& installer_state, const base::Version& new_version, - const Product& product, WorkItemList* list); // Utility method currently shared between install.cc and install_worker.cc void AppendUninstallCommandLineFlags(const InstallerState& installer_state, - const Product& product, base::CommandLine* uninstall_cmd); -// Adds work items to add or remove the "on-os-upgrade" command to |product|'s +// Adds work items to add or remove the "on-os-upgrade" command to Chrome's // version key on the basis of the current operation (represented in -// |installer_state|). |new_version| is the version of the product(s) -// currently being installed -- can be empty on uninstall. +// |installer_state|). |new_version| is the version currently being installed +// -- can be empty on uninstall. void AddOsUpgradeWorkItems(const InstallerState& installer_state, const base::FilePath& setup_path, const base::Version& new_version, - const Product& product, WorkItemList* install_list); #if defined(GOOGLE_CHROME_BUILD) -// Adds work items to add or remove the "store-dmtoken" command to |product|'s +// Adds work items to add or remove the "store-dmtoken" command to Chrome's // version key. This method is a no-op if this is anything other than // system-level Chrome. The command is used when enrolling Chrome browser -// instances into enterprise management. |new_version| is the version of the -// product(s) currently being installed -- can be empty on uninstall. +// instances into enterprise management. |new_version| is the version currently +// being installed -- can be empty on uninstall. void AddEnterpriseEnrollmentWorkItems(const InstallerState& installer_state, const base::FilePath& setup_path, const base::Version& new_version, - const Product& product, WorkItemList* install_list); #endif
diff --git a/chrome/installer/setup/install_worker_unittest.cc b/chrome/installer/setup/install_worker_unittest.cc index eb27650..3e4f4a9 100644 --- a/chrome/installer/setup/install_worker_unittest.cc +++ b/chrome/installer/setup/install_worker_unittest.cc
@@ -16,10 +16,10 @@ #include "base/win/win_util.h" #include "base/win/windows_version.h" #include "chrome/common/chrome_constants.h" +#include "chrome/install_static/install_util.h" #include "chrome/install_static/test/scoped_install_details.h" #include "chrome/installer/setup/installer_state.h" #include "chrome/installer/setup/setup_util.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/create_reg_key_work_item.h" #include "chrome/installer/util/delete_reg_key_work_item.h" #include "chrome/installer/util/delete_tree_work_item.h" @@ -35,7 +35,6 @@ using base::win::RegKey; using installer::InstallationState; using installer::InstallerState; -using installer::Product; using installer::ProductState; using ::testing::_; @@ -226,10 +225,11 @@ const ProductState* chrome = machine_state.GetProductState(installer_state->system_install()); if (chrome) { - installer_state->AddProductFromState(*chrome); + installer_state->set_target_path_for_testing( + chrome->GetSetupPath().DirName().DirName().DirName()); } else { - BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - installer_state->AddProduct(std::make_unique<Product>(dist)); + installer_state->set_target_path_for_testing( + installer::GetChromeInstallPath(installer_state->system_install())); } } @@ -259,10 +259,6 @@ // actually be touched. archive_path_ = base::FilePath(L"C:\\UnlikelyPath\\Temp\\chrome_123\\chrome.7z"); - // TODO(robertshield): Take this from the BrowserDistribution once that - // no longer depends on MasterPreferences. - installation_path_ = - base::FilePath(L"C:\\Program Files\\Google\\Chrome\\"); src_path_ = base::FilePath( L"C:\\UnlikelyPath\\Temp\\chrome_123\\source\\Chrome-bin"); setup_path_ = base::FilePath( @@ -274,7 +270,6 @@ std::unique_ptr<base::Version> current_version_; std::unique_ptr<base::Version> new_version_; base::FilePath archive_path_; - base::FilePath installation_path_; base::FilePath setup_path_; base::FilePath src_path_; base::FilePath temp_dir_; @@ -375,11 +370,9 @@ void SetupExpectations(const base::string16& brand, StrictMock<MockWorkItemList>* work_item_list) { if (!brand.empty()) { - BrowserDistribution* browser_dist = - installer_state_->product().distribution(); - DCHECK(browser_dist); base::win::RegKey key(installer_state_->root_key(), - browser_dist->GetStateKey().c_str(), KEY_WRITE); + install_static::GetClientStateKeyPath().c_str(), + KEY_WRITE); ASSERT_TRUE(key.Valid()); ASSERT_EQ( 0, key.WriteValue(google_update::kRegRLZBrandField, brand.c_str()));
diff --git a/chrome/installer/setup/installer_state.cc b/chrome/installer/setup/installer_state.cc index 53832b2a..eea86ea 100644 --- a/chrome/installer/setup/installer_state.cc +++ b/chrome/installer/setup/installer_state.cc
@@ -7,27 +7,36 @@ #include <stddef.h> #include <string> -#include <utility> #include "base/command_line.h" #include "base/files/file_util.h" #include "base/win/registry.h" -#include "chrome/install_static/install_modes.h" +#include "chrome/install_static/install_util.h" #include "chrome/installer/setup/setup_util.h" -#include "chrome/installer/util/app_registration_data.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/helper.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/installation_state.h" #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/master_preferences_constants.h" -#include "chrome/installer/util/product.h" #include "chrome/installer/util/work_item.h" #include "chrome/installer/util/work_item_list.h" namespace installer { +namespace { + +// Returns the boolean value of the distribution preference in |prefs| named +// |pref_name|, or |default_value| if not set. +bool GetMasterPreference(const MasterPreferences& prefs, + const char* pref_name, + bool default_value) { + bool value; + return prefs.GetBool(pref_name, &value) ? value : default_value; +} + +} // namespace + InstallerState::InstallerState() : operation_(UNINITIALIZED), level_(UNKNOWN_LEVEL), @@ -57,24 +66,29 @@ const InstallationState& machine_state) { Clear(); - bool pref_bool; - if (!prefs.GetBool(master_preferences::kSystemLevel, &pref_bool)) - pref_bool = false; - set_level(pref_bool ? SYSTEM_LEVEL : USER_LEVEL); + set_level(GetMasterPreference(prefs, master_preferences::kSystemLevel, false) + ? SYSTEM_LEVEL + : USER_LEVEL); - if (!prefs.GetBool(master_preferences::kVerboseLogging, &verbose_logging_)) - verbose_logging_ = false; + verbose_logging_ = + GetMasterPreference(prefs, master_preferences::kVerboseLogging, false); - if (!prefs.GetBool(master_preferences::kMsi, &msi_)) - msi_ = false; + msi_ = GetMasterPreference(prefs, master_preferences::kMsi, false); + if (!msi_) { + const ProductState* product_state = + machine_state.GetProductState(system_install()); + if (product_state != NULL) + msi_ = product_state->is_msi(); + } const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); - Product* p = AddProductFromPreferences(prefs, machine_state); - VLOG(1) << (is_uninstall ? "Uninstall Chrome" : "Install Chrome"); + // TODO(grt): Infer target_path_ from an existing install in support of + // varying install locations; see https://crbug.com/380177. + target_path_ = GetChromeInstallPath(system_install()); + state_key_ = install_static::GetClientStateKeyPath(); - BrowserDistribution* dist = p->distribution(); - state_key_ = dist->GetStateKey(); + VLOG(1) << (is_uninstall ? "Uninstall Chrome" : "Install Chrome"); if (is_uninstall) { operation_ = UNINSTALL; @@ -94,100 +108,17 @@ void InstallerState::set_level(Level level) { level_ = level; switch (level) { + case UNKNOWN_LEVEL: + root_key_ = nullptr; + return; case USER_LEVEL: root_key_ = HKEY_CURRENT_USER; - break; + return; case SYSTEM_LEVEL: root_key_ = HKEY_LOCAL_MACHINE; - break; - default: - DCHECK(level == UNKNOWN_LEVEL); - level_ = UNKNOWN_LEVEL; - root_key_ = NULL; - break; + return; } -} - -// Evaluates a product's eligibility for participation in this operation. -// We never expect these checks to fail, hence they all terminate the process in -// debug builds. See the log messages for details. -bool InstallerState::CanAddProduct(const base::FilePath* product_dir) const { - if (product_) { - LOG(DFATAL) << "Cannot process more than one product."; - return false; - } - return true; -} - -// Adds |product|, installed in |product_dir| to this object's collection. If -// |product_dir| is NULL, the product's default install location is used. -// Returns NULL if |product| is incompatible with this object. Otherwise, -// returns a pointer to the product (ownership is held by this object). -Product* InstallerState::AddProductInDirectory( - const base::FilePath* product_dir, - std::unique_ptr<Product> product) { - DCHECK(product); - const Product& the_product = *product; - - if (!CanAddProduct(product_dir)) - return nullptr; - - if (target_path_.empty()) { - DCHECK_EQ(BrowserDistribution::GetDistribution(), - the_product.distribution()); - target_path_ = - product_dir ? *product_dir : GetChromeInstallPath(system_install()); - } - - if (state_key_.empty()) - state_key_ = the_product.distribution()->GetStateKey(); - - product_ = std::move(product); - return product_.get(); -} - -Product* InstallerState::AddProduct(std::unique_ptr<Product> product) { - return AddProductInDirectory(nullptr, std::move(product)); -} - -// Adds a product constructed on the basis of |prefs|, setting this object's msi -// flag if the product is represented in |machine_state| and is msi-installed. -// Returns the product that was added, or NULL if |state| is incompatible with -// this object. Ownership is not passed to the caller. -Product* InstallerState::AddProductFromPreferences( - const MasterPreferences& prefs, - const InstallationState& machine_state) { - std::unique_ptr<Product> product_ptr( - new Product(BrowserDistribution::GetDistribution())); - - Product* product = AddProductInDirectory(nullptr, std::move(product_ptr)); - - if (product != NULL && !msi_) { - const ProductState* product_state = - machine_state.GetProductState(system_install()); - if (product_state != NULL) - msi_ = product_state->is_msi(); - } - - return product; -} - -Product* InstallerState::AddProductFromState( - const ProductState& state) { - std::unique_ptr<Product> product_ptr( - new Product(BrowserDistribution::GetDistribution())); - - // Strip off <version>/Installer/setup.exe; see GetInstallerDirectory(). - base::FilePath product_dir = - state.GetSetupPath().DirName().DirName().DirName(); - - Product* product = - AddProductInDirectory(&product_dir, std::move(product_ptr)); - - if (product != NULL) - msi_ |= state.is_msi(); - - return product; + NOTREACHED() << level; } bool InstallerState::system_install() const { @@ -197,7 +128,6 @@ base::Version* InstallerState::GetCurrentVersion( const InstallationState& machine_state) const { - DCHECK(product_); std::unique_ptr<base::Version> current_version; const ProductState* product_state = machine_state.GetProductState(level_ == SYSTEM_LEVEL); @@ -243,7 +173,6 @@ operation_ = UNINITIALIZED; target_path_.clear(); state_key_.clear(); - product_.reset(); critical_update_version_ = base::Version(); level_ = UNKNOWN_LEVEL; root_key_ = NULL; @@ -303,7 +232,7 @@ const bool system_install = this->system_install(); // Write the value for the product upon which we're operating. InstallUtil::AddInstallerResultItems( - system_install, product_->distribution()->GetStateKey(), status, + system_install, install_static::GetClientStateKeyPath(), status, string_resource_id, launch_cmd, install_list.get()); if (is_migrating_to_single() && InstallUtil::GetInstallReturnCode(status)) { #if defined(GOOGLE_CHROME_BUILD) @@ -317,8 +246,8 @@ // for success, the binaries have been uninstalled and therefore the result // will not be read by Google Update. InstallUtil::AddInstallerResultItems( - system_install, install_static::GetBinariesClientStateKeyPath(), status, - string_resource_id, launch_cmd, install_list.get()); + system_install, install_static::GetClientStateKeyPathForBinaries(), + status, string_resource_id, launch_cmd, install_list.get()); #endif } install_list->Do();
diff --git a/chrome/installer/setup/installer_state.h b/chrome/installer/setup/installer_state.h index b5a6c91..4e0aca41 100644 --- a/chrome/installer/setup/installer_state.h +++ b/chrome/installer/setup/installer_state.h
@@ -12,15 +12,11 @@ #include "base/macros.h" #include "base/strings/string16.h" #include "base/version.h" +#include "base/win/windows_types.h" #include "build/build_config.h" #include "chrome/installer/setup/progress_calculator.h" -#include "chrome/installer/util/product.h" #include "chrome/installer/util/util_constants.h" -#if defined(OS_WIN) -#include <windows.h> // NOLINT -#endif - namespace base { class CommandLine; } @@ -30,8 +26,6 @@ class InstallationState; class MasterPreferences; -class ProductState; - // Encapsulates the state of the current installation operation. This class // interprets the command-line arguments and master preferences and determines // the operations to be performed. @@ -62,16 +56,6 @@ const MasterPreferences& prefs, const InstallationState& machine_state); - // Adds a product constructed on the basis of |state|, setting this object's - // msi flag if |state| is msi-installed. Returns the product that was added, - // or NULL if |state| is incompatible with this object. Ownership is not - // passed to the caller. - Product* AddProductFromState(const ProductState& state); - - // Returns the product that was added, or NULL if |product| is incompatible - // with this object. Ownership of the return value is not given to the caller. - Product* AddProduct(std::unique_ptr<Product> product); - // The level (user or system) of this operation. Level level() const { return level_; } @@ -103,9 +87,7 @@ // verbose_logging master preferences option is true. bool verbose_logging() const { return verbose_logging_; } -#if defined(OS_WIN) HKEY root_key() const { return root_key_; } -#endif // The ClientState key by which we interact with Google Update. const base::string16& state_key() const { return state_key_; } @@ -114,11 +96,6 @@ // single-install. bool is_migrating_to_single() const { return is_migrating_to_single_; } - const Product& product() const { - DCHECK(product_); - return *product_; - } - // Returns the currently installed version in |target_path|, or NULL if no // products are installed. Ownership is passed to the caller. base::Version* GetCurrentVersion( @@ -162,26 +139,16 @@ // Clears the instance to an uninitialized state. void Clear(); - bool CanAddProduct(const base::FilePath* product_dir) const; - Product* AddProductInDirectory(const base::FilePath* product_dir, - std::unique_ptr<Product> product); - Product* AddProductFromPreferences( - const MasterPreferences& prefs, - const InstallationState& machine_state); - // Sets this object's level and updates the root_key_ accordingly. void set_level(Level level); Operation operation_; base::FilePath target_path_; base::string16 state_key_; - std::unique_ptr<Product> product_; base::Version critical_update_version_; ProgressCalculator progress_calculator_; Level level_; -#if defined(OS_WIN) HKEY root_key_; -#endif bool msi_; bool background_mode_; bool verbose_logging_; @@ -189,7 +156,7 @@ private: DISALLOW_COPY_AND_ASSIGN(InstallerState); -}; // class InstallerState +}; } // namespace installer
diff --git a/chrome/installer/setup/installer_state_unittest.cc b/chrome/installer/setup/installer_state_unittest.cc index 04bdfbed..dc0e2a34 100644 --- a/chrome/installer/setup/installer_state_unittest.cc +++ b/chrome/installer/setup/installer_state_unittest.cc
@@ -25,7 +25,6 @@ #include "base/win/scoped_handle.h" #include "chrome/common/chrome_constants.h" #include "chrome/install_static/install_util.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/fake_installation_state.h" #include "chrome/installer/util/fake_product_state.h" #include "chrome/installer/util/google_update_constants.h" @@ -134,9 +133,9 @@ state.Initialize(cmd_line, prefs, machine_state); state.WriteInstallerResult(installer::FIRST_INSTALL_SUCCESS, IDS_INSTALL_OS_ERROR_BASE, &launch_cmd); - BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); EXPECT_EQ(ERROR_SUCCESS, - key.Open(root, distribution->GetStateKey().c_str(), KEY_READ)); + key.Open(root, install_static::GetClientStateKeyPath().c_str(), + KEY_READ)); EXPECT_EQ(ERROR_SUCCESS, key.ReadValueDW(installer::kInstallerResult, &dw_value)); EXPECT_EQ(static_cast<DWORD>(0), dw_value); @@ -189,7 +188,7 @@ install_static::GetChromeInstallSubDirectory().c_str())); EXPECT_FALSE(installer_state.verbose_logging()); EXPECT_EQ(installer_state.state_key(), - BrowserDistribution::GetDistribution()->GetStateKey()); + install_static::GetClientStateKeyPath()); // Now initialize it to install system-level Chrome. { @@ -207,7 +206,7 @@ install_static::GetChromeInstallSubDirectory().c_str())); EXPECT_TRUE(installer_state.verbose_logging()); EXPECT_EQ(installer_state.state_key(), - BrowserDistribution::GetDistribution()->GetStateKey()); + install_static::GetClientStateKeyPath()); } // A fixture for testing InstallerState::DetermineCriticalVersion. Individual
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 10e81a85..e49e3b3 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc
@@ -62,7 +62,6 @@ #include "chrome/installer/setup/setup_util.h" #include "chrome/installer/setup/uninstall.h" #include "chrome/installer/setup/user_experiment.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/delete_after_reboot_helper.h" #include "chrome/installer/util/delete_old_versions.h" #include "chrome/installer/util/delete_tree_work_item.h" @@ -89,7 +88,6 @@ using installer::InstallerState; using installer::InstallationState; using installer::MasterPreferences; -using installer::Product; using installer::ProductState; namespace { @@ -226,14 +224,12 @@ // // This format is strange and its provenance is shrouded in mystery but it has // the data we need, so use it. -base::string16 FindMsiProductId(const InstallerState& installer_state, - const Product& product) { +base::string16 FindMsiProductId(const InstallerState& installer_state) { HKEY reg_root = installer_state.root_key(); - BrowserDistribution* dist = product.distribution(); - DCHECK(dist); base::win::RegistryValueIterator value_iter( - reg_root, dist->GetStateKey().c_str(), KEY_WOW64_32KEY); + reg_root, install_static::GetClientStateKeyPath().c_str(), + KEY_WOW64_32KEY); for (; value_iter.Valid(); ++value_iter) { base::string16 value_name(value_iter.Name()); if (base::StartsWith(value_name, kMsiProductIdPrefix, @@ -488,9 +484,6 @@ if (!installer_state.system_install()) { // This is a user-level installation. Make sure that we are not installing // on top of an existing system-level installation. - const Product& product = installer_state.product(); - BrowserDistribution* browser_dist = product.distribution(); - DCHECK_EQ(BrowserDistribution::GetDistribution(), browser_dist); const ProductState* user_level_product_state = original_state.GetProductState(false); @@ -567,8 +560,7 @@ const base::FilePath& setup_exe, const base::CommandLine& cmd_line, bool remove_all, - bool force_uninstall, - const Product& product) { + bool force_uninstall) { const ProductState* product_state = original_state.GetProductState(installer_state.system_install()); if (product_state != NULL) { @@ -579,9 +571,8 @@ return installer::CHROME_NOT_INSTALLED; } - return installer::UninstallProduct( - original_state, installer_state, setup_exe, product, remove_all, - force_uninstall, cmd_line); + return installer::UninstallProduct(original_state, installer_state, setup_exe, + remove_all, force_uninstall, cmd_line); } installer::InstallStatus UninstallProducts( @@ -589,8 +580,6 @@ const InstallerState& installer_state, const base::FilePath& setup_exe, const base::CommandLine& cmd_line) { - DCHECK_EQ(BrowserDistribution::GetDistribution(), - installer_state.product().distribution()); // System-level Chrome will be launched via this command if its program gets // set below. base::CommandLine system_level_cmd(base::CommandLine::NO_PROGRAM); @@ -607,9 +596,8 @@ const bool remove_all = !cmd_line.HasSwitch( installer::switches::kDoNotRemoveSharedItems); - install_status = - UninstallProduct(original_state, installer_state, setup_exe, cmd_line, - remove_all, force, installer_state.product()); + install_status = UninstallProduct(original_state, installer_state, setup_exe, + cmd_line, remove_all, force); installer::CleanUpInstallationDirectoryAfterUninstall( original_state, installer_state, setup_exe, &install_status); @@ -942,21 +930,17 @@ installer::switches::kRegisterChromeBrowserSuffix); } installer::InstallStatus tmp = installer::UNKNOWN_STATUS; - const Product& chrome_install = installer_state->product(); installer::DeleteChromeRegistrationKeys(*installer_state, - chrome_install.distribution(), HKEY_LOCAL_MACHINE, suffix, &tmp); *exit_code = tmp; } else if (cmd_line.HasSwitch(installer::switches::kOnOsUpgrade)) { - const Product& chrome_install = installer_state->product(); installer::InstallStatus status = installer::INVALID_STATE_FOR_OPTION; std::unique_ptr<FileVersionInfo> version_info( FileVersionInfo::CreateFileVersionInfo(setup_exe)); const base::Version installed_version( base::UTF16ToUTF8(version_info->product_version())); if (installed_version.IsValid()) { - installer::HandleOsUpgradeForBrowser(*installer_state, chrome_install, - installed_version); + installer::HandleOsUpgradeForBrowser(*installer_state, installed_version); status = installer::INSTALL_REPAIRED; } else { LOG(DFATAL) << "Failed to extract product version from " @@ -1210,9 +1194,8 @@ LaunchChromeBrowser(installer_state.target_path()); } else if ((install_status == NEW_VERSION_UPDATED) || (install_status == IN_USE_UPDATED)) { - const Product& chrome = installer_state.product(); DCHECK_NE(chrome_exe.value(), base::string16()); - RemoveChromeLegacyRegistryKeys(chrome.distribution(), chrome_exe); + RemoveChromeLegacyRegistryKeys(chrome_exe); } } } @@ -1239,9 +1222,8 @@ // Only when called by the MSI installer do we need to delay setting // the DisplayVersion. In other runs, such as those done by the auto- // update action, we set the value immediately. - const Product& chrome = installer_state.product(); // Get the app's MSI Product-ID from an entry in ClientState. - base::string16 app_guid = FindMsiProductId(installer_state, chrome); + base::string16 app_guid = FindMsiProductId(installer_state); if (!app_guid.empty()) { OverwriteDisplayVersions( app_guid, base::UTF8ToUTF16(installer_version->GetString()));
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index 72174bd3..76294c6c 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc
@@ -44,16 +44,12 @@ #include "chrome/installer/setup/installer_state.h" #include "chrome/installer/setup/setup_constants.h" #include "chrome/installer/setup/user_hive_visitor.h" -#include "chrome/installer/util/app_registration_data.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/installation_state.h" #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/master_preferences_constants.h" -#include "chrome/installer/util/non_updating_app_registration_data.h" -#include "chrome/installer/util/updating_app_registration_data.h" #include "chrome/installer/util/util_constants.h" #include "chrome/installer/util/work_item.h" #include "chrome/installer/util/work_item_list.h" @@ -70,37 +66,6 @@ constexpr wchar_t kEventLogProvidersRegPath[] = L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\"; -// Returns true if the "lastrun" value in |root|\|key_path| (a path to Chrome's -// ClientState key for a user) indicates that Chrome has been used within the -// last 28 days. -bool IsActivelyUsedIn(HKEY root, const wchar_t* key_path) { - VLOG(1) << "IsActivelyUsedIn probing " << root << "\\" << key_path; - int days_ago_last_run = GoogleUpdateSettings::GetLastRunTime(); - if (days_ago_last_run >= 0) { - VLOG(1) << "Found a user that last ran Chrome " << days_ago_last_run - << " days ago."; - return days_ago_last_run <= 28; - } - return false; -} - -// A visitor for user hives, run by VisitUserHives. |client_state_path| is the -// path to Chrome's ClientState key. |is_used| is set to true if Chrome has been -// used within the last 28 days based on the contents of |user_hive|, in which -// case |false| is returned to halt the hive visits. |user_sid| and |user_hive| -// are provided by VisitUserHives. -bool OnUserHive(const base::string16& client_state_path, - bool* is_used, - const wchar_t* user_sid, - base::win::RegKey* user_hive) { - // Continue the iteration if this hive isn't owned by an active Chrome user. - if (!IsActivelyUsedIn(user_hive->Handle(), client_state_path.c_str())) - return true; - // Stop the iteration. - *is_used = true; - return false; -} - // Remove the registration of the browser's DelegateExecute verb handler class. // This was once registered in support of "metro" mode on Windows 8. void RemoveLegacyIExecuteCommandKey(const InstallerState& installer_state) { @@ -680,18 +645,6 @@ allow_downgrade; } -bool IsChromeActivelyUsed(const InstallerState& installer_state) { - BrowserDistribution* chrome_dist = BrowserDistribution::GetDistribution(); - if (!installer_state.system_install()) { - return IsActivelyUsedIn(HKEY_CURRENT_USER, - chrome_dist->GetStateKey().c_str()); - } - bool is_used = false; - VisitUserHives(base::Bind(&OnUserHive, chrome_dist->GetStateKey(), - base::Unretained(&is_used))); - return is_used; -} - int GetInstallAge(const InstallerState& installer_state) { base::File::Info info; if (!base::GetFileInfo(installer_state.target_path(), &info)) @@ -784,15 +737,6 @@ WorkItem::kWow64Default); } -std::unique_ptr<AppRegistrationData> MakeBinariesRegistrationData() { - if (install_static::kUseGoogleUpdateIntegration) { - return std::make_unique<UpdatingAppRegistrationData>( - install_static::kBinariesAppGuid); - } - return std::make_unique<NonUpdatingAppRegistrationData>( - base::string16(L"Software\\").append(install_static::kBinariesPathName)); -} - bool AreBinariesInstalled(const InstallerState& installer_state) { if (!install_static::InstallDetails::Get().supported_multi_install()) return false;
diff --git a/chrome/installer/setup/setup_util.h b/chrome/installer/setup/setup_util.h index 9a46e6a5..f1e921c 100644 --- a/chrome/installer/setup/setup_util.h +++ b/chrome/installer/setup/setup_util.h
@@ -20,8 +20,6 @@ #include "chrome/installer/util/lzma_util.h" #include "chrome/installer/util/util_constants.h" -class AppRegistrationData; - namespace base { class CommandLine; class FilePath; @@ -117,9 +115,6 @@ // Returns true if downgrade is allowed by installer data. bool IsDowngradeAllowed(const MasterPreferences& prefs); -// Returns true if Chrome has been run within the last 28 days. -bool IsChromeActivelyUsed(const InstallerState& installer_state); - // Returns the age (in days) of the installation based on the creation time of // its installation directory, or -1 in case of error. int GetInstallAge(const InstallerState& installer_state); @@ -136,10 +131,6 @@ // De-register Chrome's EventLog message provider dll. void DeRegisterEventLogProvider(); -// Returns a registration data instance for the now-deprecated multi-install -// binaries. -std::unique_ptr<AppRegistrationData> MakeBinariesRegistrationData(); - // Returns true if the now-deprecated multi-install binaries are registered as // an installed product with Google Update. bool AreBinariesInstalled(const InstallerState& installer_state);
diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index ea646ddc..6f7c76b4 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc
@@ -33,11 +33,9 @@ #include "chrome/installer/setup/installer_state.h" #include "chrome/installer/setup/setup_constants.h" #include "chrome/installer/setup/setup_util.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/installation_state.h" -#include "chrome/installer/util/updating_app_registration_data.h" #include "chrome/installer/util/util_constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -312,8 +310,7 @@ installer_state_.reset(new installer::InstallerState( kSystemInstall_ ? installer::InstallerState::SYSTEM_LEVEL : installer::InstallerState::USER_LEVEL)); - installer_state_->AddProductFromState( - *original_state_->GetProductState(kSystemInstall_)); + installer_state_->set_target_path_for_testing(test_dir_.GetPath()); // Create archives in the two version dirs. ASSERT_TRUE( @@ -692,11 +689,9 @@ class FakeInstallerState : public InstallerState { public: explicit FakeInstallerState(const base::FilePath& target_path) { - BrowserDistribution* dist = BrowserDistribution::GetDistribution(); operation_ = InstallerState::SINGLE_INSTALL_OR_UPDATE; target_path_ = target_path; - state_key_ = dist->GetStateKey(); - product_ = std::make_unique<Product>(dist); + state_key_ = install_static::GetClientStateKeyPath(); level_ = InstallerState::USER_LEVEL; root_key_ = HKEY_CURRENT_USER; }
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 144833e..189b970 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc
@@ -42,7 +42,6 @@ #include "chrome/installer/setup/setup_util.h" #include "chrome/installer/setup/user_hive_visitor.h" #include "chrome/installer/util/auto_launch_util.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/channel_info.h" #include "chrome/installer/util/delete_after_reboot_helper.h" #include "chrome/installer/util/firewall_manager_win.h" @@ -85,21 +84,19 @@ } // Processes uninstall WorkItems from install_worker in no-rollback-list. -void ProcessChromeWorkItems(const InstallerState& installer_state, - const Product& product) { +void ProcessChromeWorkItems(const InstallerState& installer_state) { std::unique_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList()); work_item_list->set_log_message( "Cleanup OS upgrade command and deprecated per-user registrations"); work_item_list->set_best_effort(true); work_item_list->set_rollback_enabled(false); AddOsUpgradeWorkItems(installer_state, base::FilePath(), base::Version(), - product, work_item_list.get()); + work_item_list.get()); // Perform a best-effort cleanup of per-user keys. On system-level installs // this will only cleanup keys for the user running the uninstall but it was // considered that this was good enough (better than triggering Active Setup // for all users solely for this cleanup). - AddCleanupDeprecatedPerUserRegistrationsWorkItems(product, - work_item_list.get()); + AddCleanupDeprecatedPerUserRegistrationsWorkItems(work_item_list.get()); work_item_list->Do(); } @@ -154,7 +151,6 @@ // heuristic to determine whether a shortcut is "user-generated". This routine // can only be called for user-level installs. void RetargetUserShortcutsWithArgs(const InstallerState& installer_state, - const Product& product, const base::FilePath& old_target_exe, const base::FilePath& new_target_exe) { if (installer_state.system_install()) { @@ -181,7 +177,6 @@ // Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+). // Only shortcuts pointing to |target_exe| will be removed. void DeleteShortcuts(const InstallerState& installer_state, - const Product& product, const base::FilePath& target_exe) { // The per-user shortcut for this user, if present on a system-level install, // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). @@ -234,7 +229,7 @@ } // Get the user data directory. -base::FilePath GetUserDataDir(const Product& product) { +base::FilePath GetUserDataDir() { base::FilePath path; if (!base::PathService::Get(chrome::DIR_USER_DATA, &path)) return base::FilePath(); @@ -606,7 +601,6 @@ } bool DeleteChromeRegistrationKeys(const InstallerState& installer_state, - BrowserDistribution* dist, HKEY root, const base::string16& browser_entry_suffix, InstallStatus* exit_code) { @@ -614,7 +608,6 @@ base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); // Delete Software\Classes\ChromeHTML. - DCHECK_EQ(BrowserDistribution::GetDistribution(), dist); const base::string16 prog_id(install_static::GetProgIdPrefix() + browser_entry_suffix); base::string16 reg_prog_id(ShellUtil::kRegClasses); @@ -754,11 +747,10 @@ return true; } -void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist, - const base::FilePath& chrome_exe) { - // We used to register Chrome to handle crx files, but this turned out - // to be not worth the hassle. Remove these old registry entries if - // they exist. See: http://codereview.chromium.org/210007 +void RemoveChromeLegacyRegistryKeys(const base::FilePath& chrome_exe) { +// We used to register Chrome to handle crx files, but this turned out +// to be not worth the hassle. Remove these old registry entries if +// they exist. See: http://codereview.chromium.org/210007 #if defined(GOOGLE_CHROME_BUILD) const wchar_t kChromeExtProgId[] = L"ChromeExt"; @@ -799,12 +791,10 @@ InstallStatus UninstallProduct(const InstallationState& original_state, const InstallerState& installer_state, const base::FilePath& setup_exe, - const Product& product, bool remove_all, bool force_uninstall, const base::CommandLine& cmd_line) { InstallStatus status = installer::UNINSTALL_CONFIRMED; - BrowserDistribution* browser_dist = product.distribution(); const base::FilePath chrome_exe( installer_state.target_path().Append(installer::kChromeExe)); @@ -866,14 +856,14 @@ GetChromeInstallPath(true).Append(installer::kChromeExe)); VLOG(1) << "Retargeting user-generated Chrome shortcuts."; if (base::PathExists(system_chrome_path)) { - RetargetUserShortcutsWithArgs(installer_state, product, chrome_exe, + RetargetUserShortcutsWithArgs(installer_state, chrome_exe, system_chrome_path); } else { LOG(ERROR) << "Retarget failed: system-level Chrome not found."; } } - DeleteShortcuts(installer_state, product, chrome_exe); + DeleteShortcuts(installer_state, chrome_exe); // Delete the registry keys (Uninstall key and Version key). HKEY reg_root = installer_state.root_key(); @@ -883,9 +873,6 @@ base::string16 distribution_data(GetDistributionData()); // Remove Control Panel uninstall link. - // Assert that this is only called with the one relevant distribution. - // TODO(grt): Remove this when BrowserDistribution goes away. - DCHECK_EQ(BrowserDistribution::GetDistribution(), browser_dist); InstallUtil::DeleteRegistryKey( reg_root, install_static::GetUninstallRegistryPath(), KEY_WOW64_32KEY); @@ -909,8 +896,8 @@ // Remove all Chrome registration keys. // Registration data is put in HKCU for both system level and user level // installs. - DeleteChromeRegistrationKeys(installer_state, browser_dist, HKEY_CURRENT_USER, - suffix, &ret); + DeleteChromeRegistrationKeys(installer_state, HKEY_CURRENT_USER, suffix, + &ret); // If the user's Chrome is registered with a suffix: it is possible that old // unsuffixed registrations were left in HKCU (e.g. if this install was @@ -920,8 +907,8 @@ // default through the UI)). // Remove remaining HKCU entries with no suffix if any. if (!suffix.empty()) { - DeleteChromeRegistrationKeys(installer_state, browser_dist, - HKEY_CURRENT_USER, base::string16(), &ret); + DeleteChromeRegistrationKeys(installer_state, HKEY_CURRENT_USER, + base::string16(), &ret); // For similar reasons it is possible in very few installs (from // 21.0.1180.0 and fixed shortly after) to be installed with the new-style @@ -929,8 +916,8 @@ base::string16 old_style_suffix; if (ShellUtil::GetOldUserSpecificRegistrySuffix(&old_style_suffix) && suffix != old_style_suffix) { - DeleteChromeRegistrationKeys(installer_state, browser_dist, - HKEY_CURRENT_USER, old_style_suffix, &ret); + DeleteChromeRegistrationKeys(installer_state, HKEY_CURRENT_USER, + old_style_suffix, &ret); } } @@ -951,11 +938,11 @@ if (installer_state.system_install() || (remove_all && ShellUtil::QuickIsChromeRegisteredInHKLM(chrome_exe, suffix))) { - DeleteChromeRegistrationKeys(installer_state, browser_dist, - HKEY_LOCAL_MACHINE, suffix, &ret); + DeleteChromeRegistrationKeys(installer_state, HKEY_LOCAL_MACHINE, suffix, + &ret); } - ProcessChromeWorkItems(installer_state, product); + ProcessChromeWorkItems(installer_state); UninstallActiveSetupEntries(installer_state); @@ -993,7 +980,7 @@ bool delete_profile = ShouldDeleteProfile(cmd_line, status); ret = installer::UNINSTALL_SUCCESSFUL; - base::FilePath user_data_dir(GetUserDataDir(product)); + base::FilePath user_data_dir(GetUserDataDir()); base::FilePath backup_state_file; if (!user_data_dir.empty()) { backup_state_file = BackupLocalStateFile(user_data_dir);
diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h index 58abff6..731727b 100644 --- a/chrome/installer/setup/uninstall.h +++ b/chrome/installer/setup/uninstall.h
@@ -12,8 +12,6 @@ #include "base/strings/string16.h" #include "chrome/installer/util/util_constants.h" -class BrowserDistribution; - namespace base { class CommandLine; class FilePath; @@ -23,7 +21,6 @@ class InstallationState; class InstallerState; -class Product; enum DeleteResult { DELETE_SUCCEEDED, @@ -44,7 +41,6 @@ // |root| is the registry root (HKLM|HKCU) and |browser_entry_suffix| is the // suffix for default browser entry name in the registry (optional). bool DeleteChromeRegistrationKeys(const InstallerState& installer_state, - BrowserDistribution* dist, HKEY root, const base::string16& browser_entry_suffix, InstallStatus* exit_code); @@ -52,8 +48,7 @@ // Removes any legacy registry keys from earlier versions of Chrome that are no // longer needed. This is used during autoupdate since we don't do full // uninstalls/reinstalls to update. -void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist, - const base::FilePath& chrome_exe); +void RemoveChromeLegacyRegistryKeys(const base::FilePath& chrome_exe); // This function uninstalls a product. Hence we came up with this awesome // name for it. @@ -63,7 +58,6 @@ // setup_exe: The path to the currently running setup.exe. It and its containing // directories are left in-place if it is within the target directory of // the product being uninstalled. -// dist: Represents the distribution to be uninstalled. // remove_all: Remove all shared files, registry entries as well. // force_uninstall: Uninstall without prompting for user confirmation or // any checks for Chrome running. @@ -73,7 +67,6 @@ const InstallationState& original_state, const InstallerState& installer_state, const base::FilePath& setup_exe, - const Product& dist, bool remove_all, bool force_uninstall, const base::CommandLine& cmd_line);
diff --git a/chrome/installer/util/BUILD.gn b/chrome/installer/util/BUILD.gn index 6a9077b..44c9a8bc 100644 --- a/chrome/installer/util/BUILD.gn +++ b/chrome/installer/util/BUILD.gn
@@ -30,8 +30,7 @@ # all case", there is no definition of what works and doesn't work, and this may # also change over time. As an example at the time of this writing, chrome.exe # calls GoogleUpdateSettings::UpdateDidRunState. This function doesn't use any -# strings, but lots of other functions in BrowserDistribution do use localized -# strings. +# strings, but other functions in InstallUtil do use localized strings. # # Ideally, this should be cleaved in two parts: the main "installer util" and # some kind of mini installer util that just contains the functions needed by @@ -63,8 +62,6 @@ "experiment_metrics.h", "experiment_storage.cc", "experiment_storage.h", - "google_chrome_distribution.cc", - "google_chrome_distribution.h", "html_dialog.h", "html_dialog_impl.cc", "logging_installer.cc", @@ -75,7 +72,6 @@ "lzma_util.h", "master_preferences.cc", "master_preferences.h", - "product.h", "registry_entry.cc", "registry_entry.h", "scoped_token_privilege.cc", @@ -124,13 +120,10 @@ "app_command.h", "app_commands.cc", "app_commands.h", - "app_registration_data.h", "auto_launch_util.cc", "auto_launch_util.h", "beacons.cc", "beacons.h", - "browser_distribution.cc", - "browser_distribution.h", "callback_work_item.cc", "callback_work_item.h", "channel_info.cc", @@ -175,16 +168,12 @@ "master_preferences_constants.h", "move_tree_work_item.cc", "move_tree_work_item.h", - "non_updating_app_registration_data.cc", - "non_updating_app_registration_data.h", "registry_key_backup.cc", "registry_key_backup.h", "self_reg_work_item.cc", "self_reg_work_item.h", "set_reg_value_work_item.cc", "set_reg_value_work_item.h", - "updating_app_registration_data.cc", - "updating_app_registration_data.h", "util_constants.cc", "util_constants.h", "work_item.cc",
diff --git a/chrome/installer/util/app_registration_data.h b/chrome/installer/util/app_registration_data.h deleted file mode 100644 index fb7c863..0000000 --- a/chrome/installer/util/app_registration_data.h +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_INSTALLER_UTIL_APP_REGISTRATION_DATA_H_ -#define CHROME_INSTALLER_UTIL_APP_REGISTRATION_DATA_H_ - -#include "base/strings/string16.h" - -// An interface to retrieve product-specific key paths to communicate with -// Google Update via registry. -class AppRegistrationData { - public: - virtual ~AppRegistrationData() {} - virtual base::string16 GetStateKey() const = 0; -}; - -#endif // CHROME_INSTALLER_UTIL_APP_REGISTRATION_DATA_H_
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc deleted file mode 100644 index bdd72a3a..0000000 --- a/chrome/installer/util/browser_distribution.cc +++ /dev/null
@@ -1,71 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// This file defines a class that contains various method related to branding. -// It provides only default implementations of these methods. Usually to add -// specific branding, we will need to extend this class with a custom -// implementation. - -#include "chrome/installer/util/browser_distribution.h" - -#include <utility> - -#include "base/atomicops.h" -#include "chrome/installer/util/app_registration_data.h" -#include "chrome/installer/util/google_chrome_distribution.h" -#include "chrome/installer/util/non_updating_app_registration_data.h" - -namespace { - -// The BrowserDistribution object is never freed. -BrowserDistribution* g_browser_distribution = NULL; - -} // namespace - -BrowserDistribution::BrowserDistribution() - : app_reg_data_(std::make_unique<NonUpdatingAppRegistrationData>( - L"Software\\Chromium")) {} - -BrowserDistribution::BrowserDistribution( - std::unique_ptr<AppRegistrationData> app_reg_data) - : app_reg_data_(std::move(app_reg_data)) {} - -BrowserDistribution::~BrowserDistribution() = default; - -template<class DistributionClass> -BrowserDistribution* BrowserDistribution::GetOrCreateBrowserDistribution( - BrowserDistribution** dist) { - if (!*dist) { - DistributionClass* temp = new DistributionClass(); - if (base::subtle::NoBarrier_CompareAndSwap( - reinterpret_cast<base::subtle::AtomicWord*>(dist), NULL, - reinterpret_cast<base::subtle::AtomicWord>(temp)) != NULL) - delete temp; - } - - return *dist; -} - -// static -BrowserDistribution* BrowserDistribution::GetDistribution() { - BrowserDistribution* dist = NULL; - -#if defined(GOOGLE_CHROME_BUILD) - dist = GetOrCreateBrowserDistribution<GoogleChromeDistribution>( - &g_browser_distribution); -#else - dist = GetOrCreateBrowserDistribution<BrowserDistribution>( - &g_browser_distribution); -#endif - - return dist; -} - -const AppRegistrationData& BrowserDistribution::GetAppRegistrationData() const { - return *app_reg_data_; -} - -base::string16 BrowserDistribution::GetStateKey() const { - return app_reg_data_->GetStateKey(); -}
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h deleted file mode 100644 index 7ba8c8f0f..0000000 --- a/chrome/installer/util/browser_distribution.h +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// This file declares a class that contains various method related to branding. - -#ifndef CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ -#define CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ - -#include <memory> - -#include "base/macros.h" -#include "base/strings/string16.h" - -class AppRegistrationData; - -class BrowserDistribution { - public: - virtual ~BrowserDistribution(); - - static BrowserDistribution* GetDistribution(); - - // Getter and adaptors for the underlying |app_reg_data_|. - const AppRegistrationData& GetAppRegistrationData() const; - base::string16 GetStateKey() const; - - protected: - explicit BrowserDistribution( - std::unique_ptr<AppRegistrationData> app_reg_data); - - template<class DistributionClass> - static BrowserDistribution* GetOrCreateBrowserDistribution( - BrowserDistribution** dist); - - std::unique_ptr<AppRegistrationData> app_reg_data_; - - private: - BrowserDistribution(); - - DISALLOW_COPY_AND_ASSIGN(BrowserDistribution); -}; - -#endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc deleted file mode 100644 index 588d447a..0000000 --- a/chrome/installer/util/google_chrome_distribution.cc +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// This file defines specific implementation of BrowserDistribution class for -// Google Chrome. - -#include "chrome/installer/util/google_chrome_distribution.h" - -#include <memory> - -#include "chrome/install_static/install_util.h" -#include "chrome/installer/util/app_registration_data.h" -#include "chrome/installer/util/updating_app_registration_data.h" - -GoogleChromeDistribution::GoogleChromeDistribution() - : BrowserDistribution(std::make_unique<UpdatingAppRegistrationData>( - install_static::GetAppGuid())) {}
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h deleted file mode 100644 index 5274e4f..0000000 --- a/chrome/installer/util/google_chrome_distribution.h +++ /dev/null
@@ -1,22 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// This file extends generic BrowserDistribution class to declare Google Chrome -// specific implementation. - -#ifndef CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ -#define CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ - -#include "chrome/installer/util/browser_distribution.h" - -class GoogleChromeDistribution : public BrowserDistribution { - protected: - // Disallow construction from others. - GoogleChromeDistribution(); - - private: - friend class BrowserDistribution; -}; - -#endif // CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_
diff --git a/chrome/installer/util/non_updating_app_registration_data.cc b/chrome/installer/util/non_updating_app_registration_data.cc deleted file mode 100644 index c763c33..0000000 --- a/chrome/installer/util/non_updating_app_registration_data.cc +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/installer/util/non_updating_app_registration_data.h" - -NonUpdatingAppRegistrationData::NonUpdatingAppRegistrationData( - const base::string16& key_path) : key_path_(key_path) {} - -NonUpdatingAppRegistrationData::~NonUpdatingAppRegistrationData() {} - -base::string16 NonUpdatingAppRegistrationData::GetStateKey() const { - return key_path_; -}
diff --git a/chrome/installer/util/non_updating_app_registration_data.h b/chrome/installer/util/non_updating_app_registration_data.h deleted file mode 100644 index 374bf109..0000000 --- a/chrome/installer/util/non_updating_app_registration_data.h +++ /dev/null
@@ -1,26 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_INSTALLER_UTIL_NON_UPDATING_APP_REGISTRATION_DATA_H_ -#define CHROME_INSTALLER_UTIL_NON_UPDATING_APP_REGISTRATION_DATA_H_ - -#include "base/compiler_specific.h" -#include "base/macros.h" -#include "base/strings/string16.h" -#include "chrome/installer/util/app_registration_data.h" - -// Registration data for an app that is not updated by Google Update. -class NonUpdatingAppRegistrationData : public AppRegistrationData { - public: - explicit NonUpdatingAppRegistrationData(const base::string16& key_path); - ~NonUpdatingAppRegistrationData() override; - base::string16 GetStateKey() const override; - - private: - const base::string16 key_path_; - - DISALLOW_COPY_AND_ASSIGN(NonUpdatingAppRegistrationData); -}; - -#endif // CHROME_INSTALLER_UTIL_NON_UPDATING_APP_REGISTRATION_DATA_H_
diff --git a/chrome/installer/util/product.h b/chrome/installer/util/product.h deleted file mode 100644 index ac03702f..0000000 --- a/chrome/installer/util/product.h +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_INSTALLER_UTIL_PRODUCT_H_ -#define CHROME_INSTALLER_UTIL_PRODUCT_H_ - -#include "base/macros.h" - -class BrowserDistribution; - -namespace installer { - -// Represents an installation of a specific product which has a one-to-one -// relation to a BrowserDistribution. A product has registry settings, related -// installation/uninstallation actions and exactly one Package that represents -// the files on disk. The Package may be shared with other Product instances, -// so only the last Product to be uninstalled should remove the package. -// Right now there are no classes that derive from Product, but in -// the future, as we move away from global functions and towards a data driven -// installation, each distribution could derive from this class and provide -// distribution specific functionality. -class Product { - public: - explicit Product(BrowserDistribution* distribution) - : distribution_(distribution) {} - - ~Product() = default; - - BrowserDistribution* distribution() const { - return distribution_; - } - - protected: - BrowserDistribution* const distribution_; - - private: - DISALLOW_COPY_AND_ASSIGN(Product); -}; - -} // namespace installer - -#endif // CHROME_INSTALLER_UTIL_PRODUCT_H_
diff --git a/chrome/installer/util/product_unittest.cc b/chrome/installer/util/product_unittest.cc index d6940712..dc7fb0f5 100644 --- a/chrome/installer/util/product_unittest.cc +++ b/chrome/installer/util/product_unittest.cc
@@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/installer/util/product.h" - #include <memory> #include "base/files/file_path.h" @@ -14,13 +12,11 @@ #include "base/version.h" #include "chrome/common/chrome_paths.h" #include "chrome/install_static/install_util.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/installation_state.h" #include "testing/gtest/include/gtest/gtest.h" using base::win::RegKey; -using installer::Product; using registry_util::RegistryOverrideManager; TEST(ProductTest, ProductInstallBasic) { @@ -29,9 +25,6 @@ installer::InstallationState machine_state; machine_state.Initialize(); - std::unique_ptr<Product> product = - std::make_unique<Product>(BrowserDistribution::GetDistribution()); - base::FilePath user_data_dir; ASSERT_TRUE(base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); EXPECT_FALSE(user_data_dir.empty());
diff --git a/chrome/installer/util/updating_app_registration_data.cc b/chrome/installer/util/updating_app_registration_data.cc deleted file mode 100644 index 2f8a7a9..0000000 --- a/chrome/installer/util/updating_app_registration_data.cc +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/installer/util/updating_app_registration_data.h" - -#include "chrome/installer/util/google_update_constants.h" - -UpdatingAppRegistrationData::UpdatingAppRegistrationData( - const base::string16& app_guid) : app_guid_(app_guid) {} - -UpdatingAppRegistrationData::~UpdatingAppRegistrationData() {} - -base::string16 UpdatingAppRegistrationData::GetStateKey() const { - return base::string16(google_update::kRegPathClientState) - .append(1, L'\\') - .append(app_guid_); -}
diff --git a/chrome/installer/util/updating_app_registration_data.h b/chrome/installer/util/updating_app_registration_data.h deleted file mode 100644 index 0959178f..0000000 --- a/chrome/installer/util/updating_app_registration_data.h +++ /dev/null
@@ -1,26 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_INSTALLER_UTIL_UPDATING_APP_REGISTRATION_DATA_H_ -#define CHROME_INSTALLER_UTIL_UPDATING_APP_REGISTRATION_DATA_H_ - -#include "base/compiler_specific.h" -#include "base/macros.h" -#include "base/strings/string16.h" -#include "chrome/installer/util/app_registration_data.h" - -// Registration data for an app that is updated by Google Update. -class UpdatingAppRegistrationData : public AppRegistrationData { - public: - explicit UpdatingAppRegistrationData(const base::string16& app_guid); - ~UpdatingAppRegistrationData() override; - base::string16 GetStateKey() const override; - - private: - const base::string16 app_guid_; - - DISALLOW_COPY_AND_ASSIGN(UpdatingAppRegistrationData); -}; - -#endif // CHROME_INSTALLER_UTIL_UPDATING_APP_REGISTRATION_DATA_H_
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 64d7698..8e7615c 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -441,6 +441,7 @@ "//chrome/browser/resources/chromeos/zip_archiver/test/", "//chromeos/test/data/", "//components/chrome_apps/webstore_widget/cws_widget/", + "//ui/file_manager/base/", "//ui/file_manager/file_manager/", "//ui/file_manager/gallery/", "//ui/file_manager/image_loader/", @@ -1407,7 +1408,6 @@ "../browser/extensions/updater/extension_update_client_base_browsertest.cc", "../browser/extensions/updater/extension_update_client_base_browsertest.h", "../browser/extensions/updater/update_service_browsertest.cc", - "../browser/extensions/user_script_listener_browsertest.cc", "../browser/extensions/view_extension_source_browsertest.cc", "../browser/extensions/wake_event_page_apitest.cc", "../browser/extensions/wasm_app_browsertest.cc", @@ -3820,6 +3820,7 @@ "../browser/chromeos/login/easy_unlock/easy_unlock_screenlock_state_handler_unittest.cc", "../browser/chromeos/login/easy_unlock/easy_unlock_service_unittest_chromeos.cc", "../browser/extensions/api/file_system/consent_provider_unittest.cc", + "../browser/ui/webui/about_ui_unittest.cc", ] } else { sources += [
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java index 20d1fd42..2e03eb4 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java
@@ -22,6 +22,7 @@ import org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutHelper; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.Tab.TabHidingType; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; import org.chromium.chrome.browser.tabmodel.TabModel; @@ -270,7 +271,7 @@ } @Override - public void onHidden(Tab tab) { + public void onHidden(Tab tab, @TabHidingType int type) { mCallback.notifyCalled(); mTab.removeObserver(this); }
diff --git a/chrome/test/base/web_ui_browser_test.cc b/chrome/test/base/web_ui_browser_test.cc index ee65810..b5f7f936 100644 --- a/chrome/test/base/web_ui_browser_test.cc +++ b/chrome/test/base/web_ui_browser_test.cc
@@ -35,6 +35,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_launcher.h" #include "content/public/test/test_navigation_observer.h" #include "net/base/filename_util.h" #include "printing/buildflags/buildflags.h" @@ -214,6 +215,17 @@ RunJavascriptUsingHandler("preloadJavascriptLibraries", std::move(args), false, false, preload_host); libraries_preloaded_ = true; + + bool should_wait_flag = base::CommandLine::ForCurrentProcess()->HasSwitch( + ::content::kWaitForDebuggerWebUI); + + const std::string debugger_port = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + ::switches::kRemoteDebuggingPort); + + // Only wait if there is a debugger port, so user can issue go() command. + if (should_wait_flag && !debugger_port.empty()) + RunJavascriptUsingHandler("setWaitUser", {}, false, false, preload_host); } void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) {
diff --git a/chrome/test/chromedriver/client/command_executor.py b/chrome/test/chromedriver/client/command_executor.py index 26cb2ba..10f144f 100644 --- a/chrome/test/chromedriver/client/command_executor.py +++ b/chrome/test/chromedriver/client/command_executor.py
@@ -68,6 +68,8 @@ GET_ELEMENT_SIZE = (_Method.GET, '/session/:sessionId/element/:id/size') GET_ELEMENT_ATTRIBUTE = ( _Method.GET, '/session/:sessionId/element/:id/attribute/:name') + GET_ELEMENT_PROPERTY = ( + _Method.GET, '/session/:sessionId/element/:id/property/:name') ELEMENT_EQUALS = ( _Method.GET, '/session/:sessionId/element/:id/equals/:other') GET_COOKIES = (_Method.GET, '/session/:sessionId/cookie')
diff --git a/chrome/test/chromedriver/client/webelement.py b/chrome/test/chromedriver/client/webelement.py index 6e7a450..7f777fc 100644 --- a/chrome/test/chromedriver/client/webelement.py +++ b/chrome/test/chromedriver/client/webelement.py
@@ -31,6 +31,9 @@ def GetAttribute(self,name): return self._Execute(Command.GET_ELEMENT_ATTRIBUTE, {'name': name}) + def GetProperty(self,name): + return self._Execute(Command.GET_ELEMENT_PROPERTY, {'name': name}) + def HoverOver(self): self._Execute(Command.HOVER_OVER_ELEMENT)
diff --git a/chrome/test/chromedriver/element_commands.cc b/chrome/test/chromedriver/element_commands.cc index 35816ec5..65bdc998 100644 --- a/chrome/test/chromedriver/element_commands.cc +++ b/chrome/test/chromedriver/element_commands.cc
@@ -404,6 +404,26 @@ value); } +Status ExecuteGetElementProperty(Session* session, + WebView* web_view, + const std::string& element_id, + const base::DictionaryValue& params, + std::unique_ptr<base::Value>* value) { + base::ListValue args; + args.Append(CreateElement(element_id)); + + std::string name; + if (!params.GetString("name", &name)) + return Status(kUnknownError, "missing 'name'"); + args.AppendString(name); + + return web_view->CallFunction( + session->GetCurrentFrameId(), + "function(elem, name) { return elem[name] }", + args, + value); +} + Status ExecuteGetElementTagName(Session* session, WebView* web_view, const std::string& element_id,
diff --git a/chrome/test/chromedriver/element_commands.h b/chrome/test/chromedriver/element_commands.h index 8ae81fe..05c714d 100644 --- a/chrome/test/chromedriver/element_commands.h +++ b/chrome/test/chromedriver/element_commands.h
@@ -129,6 +129,13 @@ const base::DictionaryValue& params, std::unique_ptr<base::Value>* value); +// Returns the value of a given element property. +Status ExecuteGetElementProperty(Session* session, + WebView* web_view, + const std::string& element_id, + const base::DictionaryValue& params, + std::unique_ptr<base::Value>* value); + // Returns the lower case tag name of a given element. Status ExecuteGetElementTagName(Session* session, WebView* web_view,
diff --git a/chrome/test/chromedriver/log_replay/client_replay.py b/chrome/test/chromedriver/log_replay/client_replay.py index 56320f0..7ab3a2d6 100755 --- a/chrome/test/chromedriver/log_replay/client_replay.py +++ b/chrome/test/chromedriver/log_replay/client_replay.py
@@ -115,6 +115,8 @@ "GetCookies": (Method.GET, "/session/:sessionId/cookie"), "GetElementAttribute": (Method.GET, "/session/:sessionId/element/:id/attribute/:name"), + "GetElementProperty": + (Method.GET, "/session/:sessionId/element/:id/property/:name"), "GetElementCSSProperty": (Method.GET, "/session/:sessionId/element/:id/css/:propertyName"), "GetElementLocation":
diff --git a/chrome/test/chromedriver/run_buildbot_steps.py b/chrome/test/chromedriver/run_buildbot_steps.py index 2659f124..4ac25b6 100755 --- a/chrome/test/chromedriver/run_buildbot_steps.py +++ b/chrome/test/chromedriver/run_buildbot_steps.py
@@ -346,14 +346,9 @@ def _WaitForLatestSnapshot(commit_position): util.MarkBuildStepStart('wait_for_snapshot') - assert commit_position is not None, 'Missing commit_position' - if util.IsMac(): - # https://bugs.chromium.org/p/chromedriver/issues/detail?id=2584 - # Mac Chromium builds are slow. Allow slightly out-of-date builds. - commit_position = int(commit_position) - 100 for attempt in range(0, 200): snapshot_position = archive.GetLatestSnapshotPosition() - if snapshot_position is not None: + if commit_position is not None and snapshot_position is not None: if int(snapshot_position) >= int(commit_position): break util.PrintAndFlush('Waiting for snapshot >= %s, found %s' %
diff --git a/chrome/test/chromedriver/server/http_handler.cc b/chrome/test/chromedriver/server/http_handler.cc index fb877f8..8eb4382 100644 --- a/chrome/test/chromedriver/server/http_handler.cc +++ b/chrome/test/chromedriver/server/http_handler.cc
@@ -181,6 +181,9 @@ CommandMapping(kGet, "session/:sessionId/element/:id/attribute/:name", WrapToCommand("GetElementAttribute", base::Bind(&ExecuteGetElementAttribute))), + CommandMapping(kGet, "session/:sessionId/element/:id/property/:name", + WrapToCommand("GetElementProperty", + base::Bind(&ExecuteGetElementProperty))), CommandMapping( kGet, "session/:sessionId/element/:id/css/:propertyName", WrapToCommand("GetElementCSSProperty",
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py index ac35e0c..a1dc076 100755 --- a/chrome/test/chromedriver/test/run_py_tests.py +++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -755,6 +755,13 @@ elem = self._driver.FindElement("name", "phones") self.assertEquals('3', elem.GetAttribute('size')) + def testGetElementProperty(self): + self._driver.Load(self.GetHttpUrlForFile( + '/chromedriver/two_inputs.html')) + elem = self._driver.FindElement("id", "first") + self.assertEquals('text', elem.GetProperty('type')) + self.assertEquals('first', elem.GetProperty('id')) + def testGetElementSpecialCharAttribute(self): self._driver.Load(self.GetHttpUrlForFile( '/chromedriver/attribute_colon_test.html'))
diff --git a/chrome/test/data/page_load_metrics/javascript_href.html b/chrome/test/data/page_load_metrics/javascript_href.html new file mode 100644 index 0000000..ef87ea6 --- /dev/null +++ b/chrome/test/data/page_load_metrics/javascript_href.html
@@ -0,0 +1,15 @@ +<html> + <head> + <style> + body { + margin: 0px; + } + a { + font-size: 1000px; + } + </style> + </head> + <body> + <a onclick="window.location.href= '/title1.html';">CLICK ME</a> + </body> +</html> \ No newline at end of file
diff --git a/chrome/test/data/page_load_metrics/javascript_window_open.html b/chrome/test/data/page_load_metrics/javascript_window_open.html new file mode 100644 index 0000000..72cf65e0 --- /dev/null +++ b/chrome/test/data/page_load_metrics/javascript_window_open.html
@@ -0,0 +1,15 @@ +<html> + <head> + <style> + body { + margin: 0px; + } + a { + font-size: 1000px; + } + </style> + </head> + <body> + <a onclick="window.open('/title1.html');">CLICK ME</a> + </body> +</html> \ No newline at end of file
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 13781f3..aaf7f21c 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -3294,6 +3294,14 @@ ] }, + "EnterpriseHardwarePlatformAPIEnabled": { + "os": ["win", "linux", "mac", "chromeos", "android"], + "test_policy": { "EnterpriseHardwarePlatformAPIEnabled": false }, + "pref_mappings": [ + { "pref": "enterprise_hardware_platform_api.enabled" } + ] + }, + "----- Chrome OS device policies ---------------------------------------": {}, "DevicePolicyRefreshRate": {
diff --git a/chrome/test/data/webui/test_api.js b/chrome/test/data/webui/test_api.js index 3e9739f..a5a88962 100644 --- a/chrome/test/data/webui/test_api.js +++ b/chrome/test/data/webui/test_api.js
@@ -29,6 +29,14 @@ var currentTestCase = null; /** + * Value set to true by WebUIBrowserTest if test harness should wait for user to + * attach a debugger. + * + * @type {boolean} + */ +var waitUser = false; + +/** * The string representation of the currently running test function. * @type {?string} */ @@ -1052,6 +1060,12 @@ * @see runTestFunction */ function runTest(isAsync, testFunction, testArguments) { + // If waiting for user to attach a debugger, retry in 1 second. + if (waitUser) { + setTimeout(runTest, 1000, isAsync, testFunction, testArguments); + return true; + } + // Avoid eval() if at all possible, since it will not work on pages // that have enabled content-security-policy. var testBody = this[testFunction]; // global object -- not a method. @@ -1169,6 +1183,25 @@ currentTestCase.preLoad(); } + +/** + * Sets |waitUser| to true so |runTest| function waits for user to attach a + * debugger. + */ +function setWaitUser() { + waitUser = true; + console.log('Waiting for debugger...'); + console.log('Run: go() in the JS console when you are ready.'); +} + +/** + * Sets |waitUser| to false, so |runTest| function stops waiting for user and + * start running the tests. + */ +function go() { + waitUser = false; +} + /** * During generation phase, this outputs; do nothing at runtime. */ @@ -1758,6 +1791,8 @@ exportExpects(); exportMock4JsHelpers(); exports.preloadJavascriptLibraries = preloadJavascriptLibraries; +exports.setWaitUser = setWaitUser; +exports.go = go; exports.registerMessageCallback = registerMessageCallback; exports.registerMockGlobals = registerMockGlobals; exports.registerMockMessageCallbacks = registerMockMessageCallbacks;
diff --git a/chromecast/browser/cast_web_view_default.cc b/chromecast/browser/cast_web_view_default.cc index 44f5f41..129d3da3 100644 --- a/chromecast/browser/cast_web_view_default.cc +++ b/chromecast/browser/cast_web_view_default.cc
@@ -124,7 +124,7 @@ void CastWebViewDefault::ClosePage(const base::TimeDelta& shutdown_delay) { shutdown_delay_ = shutdown_delay; content::WebContentsObserver::Observe(nullptr); - web_contents_->DispatchBeforeUnload(); + web_contents_->DispatchBeforeUnload(false /* auto_cancel */); web_contents_->ClosePage(); }
diff --git a/chromecast/media/cma/decoder/cast_audio_decoder.cc b/chromecast/media/cma/decoder/cast_audio_decoder.cc index fa64a2e..bf337d8 100644 --- a/chromecast/media/cma/decoder/cast_audio_decoder.cc +++ b/chromecast/media/cma/decoder/cast_audio_decoder.cc
@@ -58,25 +58,30 @@ DCHECK(task_runner_->RunsTasksInCurrentSequence()); DCHECK(!initialized_); - input_channel_count_ = config_.channel_number; + input_channel_count_ = config.channel_number; output_channel_layout_ = output_channel_layout; - config_ = config; - if (config.is_encrypted()) { + + media::AudioConfig input_config = config; + if (input_config.is_encrypted()) { LOG(ERROR) << "Cannot decode encrypted audio"; - OnInitialized(false); - return; + // TODO(kmackay) Should call OnInitialized(false) here, but that generally + // causes the browsertests to crash since it happens during the render + // pipeline initialization. + input_config.encryption_scheme = Unencrypted(); } + config_ = input_config; // Remix to desired channel layout; update config_ to match what this class // outputs. - CreateMixerIfNeeded(config_.channel_number); + CreateMixerIfNeeded(input_channel_count_); config_.channel_number = ::media::ChannelLayoutToChannelCount(output_channel_layout_); decoder_ = std::make_unique<::media::FFmpegAudioDecoder>(task_runner_, &media_log_); decoder_->Initialize( - media::DecoderConfigAdapter::ToMediaAudioDecoderConfig(config), nullptr, + media::DecoderConfigAdapter::ToMediaAudioDecoderConfig(input_config), + nullptr, base::BindRepeating(&CastAudioDecoderImpl::OnInitialized, weak_this_), base::BindRepeating(&CastAudioDecoderImpl::OnDecoderOutput, weak_this_), ::media::AudioDecoder::WaitingForDecryptionKeyCB());
diff --git a/chromecast/public/reboot_shlib.h b/chromecast/public/reboot_shlib.h index c12ef1f..e74b99d5 100644 --- a/chromecast/public/reboot_shlib.h +++ b/chromecast/public/reboot_shlib.h
@@ -51,13 +51,20 @@ // detected. CRASH_UPLOADER = 7, - // A reboot caused by an FDR related source. + // A reboot caused by an FDR related source. // Note: Calling RebootNow(RebootSource::FDR) does not imply that // an FDR must happen upon reboot; it is simply an indicator that a reboot // request is coming from an FDR-related source. // Only if SetFdrForNextReboot() has been called must reboot to result // in an OTA update. FDR = 8, + + // A reboot caused by hardware watchdog. This requires additional + // information from the SoC. Otherwise, it can be categorized as forced. + HW_WATCHDOG = 9, + + // A reboot caused by other software reason that is not listed above. + SW_OTHER = 10, }; // Initializes any platform-specific reboot systems.
diff --git a/chromecast/system/reboot/reboot_util_core.cc b/chromecast/system/reboot/reboot_util_core.cc index 4d57445d..c6840bb 100644 --- a/chromecast/system/reboot/reboot_util_core.cc +++ b/chromecast/system/reboot/reboot_util_core.cc
@@ -37,6 +37,8 @@ case RebootShlib::RebootSource::PROCESS_MANAGER: case RebootShlib::RebootSource::CRASH_UPLOADER: case RebootShlib::RebootSource::FDR: + case RebootShlib::RebootSource::HW_WATCHDOG: + case RebootShlib::RebootSource::SW_OTHER: return true; default: return false;
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 2f9472a3..84a430c 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -11066.0.0 \ No newline at end of file +11079.0.0 \ No newline at end of file
diff --git a/chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom b/chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom index 61a1f9b..ef3fe84 100644 --- a/chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom +++ b/chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom
@@ -140,16 +140,16 @@ GetEligibleHostDevices() => (array<chromeos.device_sync.mojom.RemoteDevice> eligible_host_devices); - // Sets the host associated with the provided public key as the host device + // Sets the host associated with the provided device ID as the host device // for this account. The provided auth token must be valid in order to prove // that the user is authenticated. If called when there is no current host or // when the current host is a different device from the one passed, this // function initiates a connection to the back-end and attempts to set the // host. When called with the same device that is already the host, this // function is a no-op. Returns a success boolean; this function will fail if - // the provided public key does not correspond to an eligible host device on + // the provided device ID does not correspond to an eligible host device on // the account, or the provided auth token is invalid. - SetHostDevice(string public_key, string auth_token) => (bool success); + SetHostDevice(string device_id, string auth_token) => (bool success); // Removes the currently-set host as the multi-device host for this account. // If there was no host set to begin with, this function is a no-op.
diff --git a/components/autofill_assistant/browser/web_controller.cc b/components/autofill_assistant/browser/web_controller.cc index 958881f..e93257b 100644 --- a/components/autofill_assistant/browser/web_controller.cc +++ b/components/autofill_assistant/browser/web_controller.cc
@@ -84,7 +84,7 @@ std::unique_ptr<runtime::CallFunctionOnResult> result) { devtools_client_->GetRuntime()->Disable(); if (!result || result->HasExceptionDetails()) { - DLOG(ERROR) << "Failed to scroll the element into view to click."; + DLOG(ERROR) << "Failed to scroll the element."; OnResult(false, std::move(callback)); return; } @@ -295,6 +295,42 @@ std::move(callback).Run(result); } +void WebController::OnFindElementForFocusElement( + base::OnceCallback<void(bool)> callback, + std::string object_id) { + if (object_id.empty()) { + DLOG(ERROR) << "Failed to find the element to focus on."; + OnResult(false, std::move(callback)); + return; + } + + std::vector<std::unique_ptr<runtime::CallArgument>> argument; + argument.emplace_back( + runtime::CallArgument::Builder().SetObjectId(object_id).Build()); + devtools_client_->GetRuntime()->Enable(); + devtools_client_->GetRuntime()->CallFunctionOn( + runtime::CallFunctionOnParams::Builder() + .SetObjectId(object_id) + .SetArguments(std::move(argument)) + .SetFunctionDeclaration(std::string(kScrollIntoViewScript)) + .SetReturnByValue(true) + .Build(), + base::BindOnce(&WebController::OnFocusElement, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); +} + +void WebController::OnFocusElement( + base::OnceCallback<void(bool)> callback, + std::unique_ptr<runtime::CallFunctionOnResult> result) { + devtools_client_->GetRuntime()->Disable(); + if (!result || result->HasExceptionDetails()) { + DLOG(ERROR) << "Failed to focus on element."; + OnResult(false, std::move(callback)); + return; + } + OnResult(true, std::move(callback)); +} + void WebController::FillAddressForm(const std::string& guid, const std::vector<std::string>& selectors, base::OnceCallback<void(bool)> callback) { @@ -318,8 +354,11 @@ void WebController::FocusElement(const std::vector<std::string>& selectors, base::OnceCallback<void(bool)> callback) { - // TODO(crbug.com/806868): Implement focus on element operation. - std::move(callback).Run(true); + DCHECK(!selectors.empty()); + FindElement( + selectors, + base::BindOnce(&WebController::OnFindElementForFocusElement, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } void WebController::GetFieldsValue(
diff --git a/components/autofill_assistant/browser/web_controller.h b/components/autofill_assistant/browser/web_controller.h index ae1d0188..99b3876 100644 --- a/components/autofill_assistant/browser/web_controller.h +++ b/components/autofill_assistant/browser/web_controller.h
@@ -122,6 +122,10 @@ base::OnceCallback<void(std::string)> callback, std::unique_ptr<dom::PushNodesByBackendIdsToFrontendResult> result); void OnResult(bool result, base::OnceCallback<void(bool)> callback); + void OnFindElementForFocusElement(base::OnceCallback<void(bool)> callback, + std::string object_id); + void OnFocusElement(base::OnceCallback<void(bool)> callback, + std::unique_ptr<runtime::CallFunctionOnResult> result); // Weak pointer is fine here since it must outlive this web controller, which // is guaranteed by the owner of this object.
diff --git a/components/autofill_assistant/browser/web_controller_browsertest.cc b/components/autofill_assistant/browser/web_controller_browsertest.cc index da0485e..76ba27a 100644 --- a/components/autofill_assistant/browser/web_controller_browsertest.cc +++ b/components/autofill_assistant/browser/web_controller_browsertest.cc
@@ -5,6 +5,7 @@ #include "base/bind.h" #include "components/autofill_assistant/browser/web_controller.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" @@ -83,6 +84,20 @@ } } + void FocusElement(const std::vector<std::string>& selectors) { + base::RunLoop run_loop; + web_controller_->FocusElement( + selectors, + base::BindOnce(&WebControllerBrowserTest::OnFocusElement, + base::Unretained(this), run_loop.QuitClosure())); + run_loop.Run(); + } + + void OnFocusElement(base::Closure done_callback, bool result) { + ASSERT_TRUE(result); + std::move(done_callback).Run(); + } + private: std::unique_ptr<net::EmbeddedTestServer> http_server_; std::unique_ptr<autofill_assistant::WebController> web_controller_; @@ -141,4 +156,52 @@ selectors.emplace_back("#button"); WaitForElementRemove(selectors); } + +IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, FocusElement) { + std::vector<std::string> selectors; + selectors.emplace_back("#iframe"); + selectors.emplace_back("#focus"); + + // The element is not visible initially. + const std::string checkNotVisibleScript = R"( + let iframe = document.querySelector("#iframe"); + let div = iframe.contentDocument.querySelector("#focus"); + let iframeRect = iframe.getBoundingClientRect(); + let divRect = div.getBoundingClientRect(); + iframeRect.y + divRect.y > window.innerHeight; + )"; + EXPECT_EQ(true, content::EvalJs(shell(), checkNotVisibleScript)); + FocusElement(selectors); + + // Verify that the scroll moved the div in the iframe into view. + const std::string checkVisibleScript = R"( + const scrollTimeoutMs = 500; + var timer = null; + + function check() { + let iframe = document.querySelector("#iframe"); + let div = iframe.contentDocument.querySelector("#focus"); + let iframeRect = iframe.getBoundingClientRect(); + let divRect = div.getBoundingClientRect(); + return iframeRect.y + divRect.y < window.innerHeight; + } + function onScrollDone() { + window.removeEventListener("scroll", onScroll); + domAutomationController.send(check()); + } + function onScroll(e) { + if (timer != null) { + clearTimeout(timer); + } + timer = setTimeout(onScrollDone, scrollTimeoutMs); + } + if (check()) { + // Scrolling finished before this script started. Just return the result. + domAutomationController.send(true); + } else { + window.addEventListener("scroll", onScroll); + } + )"; + EXPECT_EQ(true, content::EvalJsWithManualReply(shell(), checkVisibleScript)); +} } // namespace
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc index 22ba7a30..975099e8 100644 --- a/components/browser_sync/profile_sync_service.cc +++ b/components/browser_sync/profile_sync_service.cc
@@ -2022,8 +2022,19 @@ for (syncer::ModelType type : all_types) { const auto dtc_iter = data_type_controllers_.find(type); if (dtc_iter != data_type_controllers_.end()) { - dtc_iter->second->GetAllNodes(base::BindRepeating( - &GetAllNodesRequestHelper::OnReceivedNodesForType, helper)); + if (dtc_iter->second->state() == + syncer::DataTypeController::NOT_RUNNING) { + // In the NOT_RUNNING state it's not allowed to call GetAllNodes on the + // DataTypeController, so just return an empty result. + // This can happen e.g. if we're waiting for a custom passphrase to be + // entered - the data types are already considered active in this case, + // but their DataTypeControllers are still NOT_RUNNING. + helper->OnReceivedNodesForType(type, + std::make_unique<base::ListValue>()); + } else { + dtc_iter->second->GetAllNodes(base::BindRepeating( + &GetAllNodesRequestHelper::OnReceivedNodesForType, helper)); + } } else { // Control Types. helper->OnReceivedNodesForType( @@ -2289,6 +2300,9 @@ auto dtc_it = data_type_controllers_.find(type); if (dtc_it != data_type_controllers_.end() && dtc_it->second->state() != syncer::DataTypeController::NOT_RUNNING) { + // It's possible that a data type is considered active, but its + // DataTypeController is still NOT_RUNNING, in the case where we're + // waiting for a custom passphrase. dtc_it->second->RecordMemoryUsageAndCountsHistograms(); } }
diff --git a/components/download/content/internal/download_driver_impl.cc b/components/download/content/internal/download_driver_impl.cc index 215babd8..5d0ad19 100644 --- a/components/download/content/internal/download_driver_impl.cc +++ b/components/download/content/internal/download_driver_impl.cc
@@ -7,6 +7,7 @@ #include <set> #include <vector> +#include "base/bind_helpers.h" #include "base/metrics/histogram_functions.h" #include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/memory_usage_estimator.h" @@ -176,22 +177,27 @@ nullptr /* blob_url_loader_factory */); } -void DownloadDriverImpl::Remove(const std::string& guid) { +void DownloadDriverImpl::Remove(const std::string& guid, bool remove_file) { guid_to_remove_.emplace(guid); // DownloadItem::Remove will cause the item object removed from memory, post // the remove task to avoid the object being accessed in the same call stack. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(&DownloadDriverImpl::DoRemoveDownload, - weak_ptr_factory_.GetWeakPtr(), guid)); + FROM_HERE, + base::BindOnce(&DownloadDriverImpl::DoRemoveDownload, + weak_ptr_factory_.GetWeakPtr(), guid, remove_file)); } -void DownloadDriverImpl::DoRemoveDownload(const std::string& guid) { +void DownloadDriverImpl::DoRemoveDownload(const std::string& guid, + bool remove_file) { if (!download_manager_) return; DownloadItem* item = download_manager_->GetDownloadByGuid(guid); // Cancels the download and removes the persisted records in content layer. if (item) { + // Remove the download file for completed download. + if (remove_file) + item->DeleteFile(base::DoNothing()); item->Remove(); } } @@ -278,9 +284,9 @@ // Client has removed the download before content persistence layer created // the record, remove the download immediately. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(&DownloadDriverImpl::DoRemoveDownload, - weak_ptr_factory_.GetWeakPtr(), item->GetGuid())); + FROM_HERE, base::BindOnce(&DownloadDriverImpl::DoRemoveDownload, + weak_ptr_factory_.GetWeakPtr(), + item->GetGuid(), false /* remove_file */)); return; }
diff --git a/components/download/content/internal/download_driver_impl.h b/components/download/content/internal/download_driver_impl.h index f9a155f60..89d5a06e2 100644 --- a/components/download/content/internal/download_driver_impl.h +++ b/components/download/content/internal/download_driver_impl.h
@@ -44,7 +44,7 @@ const base::FilePath& file_path, scoped_refptr<network::ResourceRequestBody> post_body, const net::NetworkTrafficAnnotationTag& traffic_annotation) override; - void Remove(const std::string& guid) override; + void Remove(const std::string& guid, bool remove_file) override; void Pause(const std::string& guid) override; void Resume(const std::string& guid) override; base::Optional<DriverEntry> Find(const std::string& guid) override; @@ -65,7 +65,7 @@ void OnHardRecoverComplete(bool success); // Remove the download, used to be posted to the task queue. - void DoRemoveDownload(const std::string& guid); + void DoRemoveDownload(const std::string& guid, bool remove_file); // Low level download handle. content::DownloadManager* download_manager_;
diff --git a/components/download/content/internal/download_driver_impl_unittest.cc b/components/download/content/internal/download_driver_impl_unittest.cc index 30ebc59..3e8bbd1 100644 --- a/components/download/content/internal/download_driver_impl_unittest.cc +++ b/components/download/content/internal/download_driver_impl_unittest.cc
@@ -116,7 +116,7 @@ // Download is not created yet in content layer. ON_CALL(mock_manager_, GetDownloadByGuid(kTestGuid)) .WillByDefault(Return(nullptr)); - driver_->Remove(kTestGuid); + driver_->Remove(kTestGuid, false); task_runner_->RunUntilIdle(); // Download is created in content layer.
diff --git a/components/download/internal/background_service/controller_impl.cc b/components/download/internal/background_service/controller_impl.cc index 0de010f..3993710d 100644 --- a/components/download/internal/background_service/controller_impl.cc +++ b/components/download/internal/background_service/controller_impl.cc
@@ -429,6 +429,7 @@ entry->url_chain = download.url_chain; entry->response_headers = download.response_headers; + entry->did_received_response = true; model_->Update(*entry); download::Client* client = clients_->GetClient(entry->client); @@ -565,7 +566,7 @@ // DriverEntry. If we restart we'll see a COMPLETE state and handle it // accordingly. if (entry->state == Entry::State::COMPLETE) - driver_->Remove(guid); + driver_->Remove(guid, false); // TODO(dtrainor): If failed, clean up any download state accordingly. @@ -731,7 +732,7 @@ } for (const auto& guid : guids_to_remove) { - driver_->Remove(guid); + driver_->Remove(guid, false); model_->Remove(guid); } @@ -794,6 +795,15 @@ break; } + // We didn't persist the response headers in time, so just restart the + // the fetch. The driver entry and the temporary file will also be + // deleted. + if (state == Entry::State::ACTIVE && entry->require_response_headers && + !entry->did_received_response) { + driver_->Remove(entry->guid, true /* remove_file */); + break; + } + // If we have a real DriverEntry::State, we need to determine which of // those states makes sense for our Entry. Our entry can either be in // two states now: It's effective 'active' state (ACTIVE or PAUSED) or @@ -841,7 +851,7 @@ case Entry::State::AVAILABLE: // Intentional fallthrough. // We should not have a DriverEntry here. if (driver_entry.has_value()) - driver_->Remove(entry->guid); + driver_->Remove(entry->guid, false); break; case Entry::State::ACTIVE: // Intentional fallthrough. case Entry::State::PAUSED: @@ -866,7 +876,7 @@ } else { // We're staying in COMPLETE. Make sure there is no DriverEntry here. if (driver_entry.has_value()) - driver_->Remove(entry->guid); + driver_->Remove(entry->guid, false); } break; case Entry::State::COUNT: @@ -1128,7 +1138,8 @@ entry->completion_time = driver_entry->completion_time; entry->bytes_downloaded = driver_entry->bytes_downloaded; CompletionInfo completion_info(driver_entry->current_file_path, - driver_entry->bytes_downloaded); + driver_entry->bytes_downloaded, + entry->url_chain, entry->response_headers); completion_info.blob_handle = driver_entry->blob_handle; entry->last_cleanup_check_time = driver_entry->completion_time; @@ -1147,7 +1158,7 @@ // TODO(dtrainor): Handle the case where we crash before the model write // happens and we have no driver entry. - driver_->Remove(entry->guid); + driver_->Remove(entry->guid, false); model_->Remove(guid); }
diff --git a/components/download/internal/background_service/controller_impl_unittest.cc b/components/download/internal/background_service/controller_impl_unittest.cc index 228181c..c6c2975 100644 --- a/components/download/internal/background_service/controller_impl_unittest.cc +++ b/components/download/internal/background_service/controller_impl_unittest.cc
@@ -1007,7 +1007,9 @@ DriverEntry dentry = BuildDriverEntry(entry, DriverEntry::State::IN_PROGRESS); driver_->AddTestData(std::vector<DriverEntry>{dentry}); - CompletionInfo completion_info(base::FilePath::FromUTF8Unsafe("123"), 1024u); + CompletionInfo completion_info(dentry.current_file_path, + dentry.bytes_downloaded, entry.url_chain, + entry.response_headers); EXPECT_CALL(*client_, OnServiceInitialized(false, _)).Times(1); EXPECT_CALL(*client_, OnDownloadSucceeded(entry.guid, completion_info)) .Times(1); @@ -1560,6 +1562,44 @@ verify_entry(entries[14].guid, Entry::State::COMPLETE, base::nullopt); } +// Download driver will remove the download if failed to persist the response +// headers. +TEST_F(DownloadServiceControllerImplTest, StartupRecoveryNoResponseHeaders) { + std::vector<Entry> entries; + std::vector<DriverEntry> driver_entries; + entries.push_back(test::BuildBasicEntry(Entry::State::ACTIVE)); + entries.back().response_headers = nullptr; + entries.back().did_received_response = false; + + driver_entries.push_back( + BuildDriverEntry(entries.back(), DriverEntry::State::IN_PROGRESS)); + + device_status_listener_->SetDeviceStatus( + DeviceStatus(BatteryStatus::CHARGING, NetworkStatus::UNMETERED)); + + InitializeController(); + driver_->AddTestData(driver_entries); + driver_->MakeReady(); + store_->AutomaticallyTriggerAllFutureCallbacks(true); + store_->TriggerInit(true, std::make_unique<std::vector<Entry>>(entries)); + file_monitor_->TriggerInit(true); + + // Verify that the driver entry will be removed without response headers. + EXPECT_FALSE(driver_->Find(entries[0].guid).has_value()); + + task_runner_->RunUntilIdle(); + + // The download is retried. + EXPECT_EQ(Entry::State::ACTIVE, model_->Get(entries[0].guid)->state); + EXPECT_TRUE(model_->Get(entries[0].guid)->did_received_response); + auto expected_driver_entry = driver_->Find(entries[0].guid); + EXPECT_TRUE(expected_driver_entry.has_value()); + EXPECT_EQ(model_->Get(entries[0].guid)->url_chain, + expected_driver_entry->url_chain); + EXPECT_EQ(model_->Get(entries[0].guid)->response_headers->raw_headers(), + expected_driver_entry->response_headers->raw_headers()); +} + TEST_F(DownloadServiceControllerImplTest, ExistingExternalDownload) { Entry entry1 = test::BuildBasicEntry(Entry::State::ACTIVE); Entry entry2 = test::BuildBasicEntry(Entry::State::ACTIVE);
diff --git a/components/download/internal/background_service/download_driver.h b/components/download/internal/background_service/download_driver.h index 0243340..6541e4d 100644 --- a/components/download/internal/background_service/download_driver.h +++ b/components/download/internal/background_service/download_driver.h
@@ -92,8 +92,10 @@ const net::NetworkTrafficAnnotationTag& traffic_annotation) = 0; // Cancels an existing download, all data associated with this download should - // be removed. - virtual void Remove(const std::string& guid) = 0; + // be removed. If download is not completed, the temporary file will be + // deleted. If download is completed, the download file will be deleted when + // |remove_file| is true. + virtual void Remove(const std::string& guid, bool remove_file) = 0; // Pauses the download. virtual void Pause(const std::string& guid) = 0;
diff --git a/components/download/internal/background_service/entry.cc b/components/download/internal/background_service/entry.cc index 3db8d442..5166bdd 100644 --- a/components/download/internal/background_service/entry.cc +++ b/components/download/internal/background_service/entry.cc
@@ -24,7 +24,9 @@ attempt_count(0), resumption_count(0), cleanup_attempt_count(0), - has_upload_data(false) {} + has_upload_data(false), + did_received_response(false), + require_response_headers(true) {} Entry::Entry(const Entry& other) = default; Entry::Entry(const DownloadParams& params) @@ -38,7 +40,9 @@ resumption_count(0), cleanup_attempt_count(0), has_upload_data(false), - traffic_annotation(params.traffic_annotation) {} + traffic_annotation(params.traffic_annotation), + did_received_response(false), + require_response_headers(true) {} Entry::~Entry() = default; @@ -65,7 +69,10 @@ has_upload_data == other.has_upload_data && traffic_annotation == other.traffic_annotation && url_chain == other.url_chain && - AreHeadersEqual(response_headers.get(), other.response_headers.get()); + AreHeadersEqual(response_headers.get(), + other.response_headers.get()) && + did_received_response == other.did_received_response && + require_response_headers == other.require_response_headers; } size_t Entry::EstimateMemoryUsage() const {
diff --git a/components/download/internal/background_service/entry.h b/components/download/internal/background_service/entry.h index 6133d9cd..b12ad1f8 100644 --- a/components/download/internal/background_service/entry.h +++ b/components/download/internal/background_service/entry.h
@@ -114,6 +114,14 @@ // The response headers for the download request. scoped_refptr<const net::HttpResponseHeaders> response_headers; + + // If the response is received. |response_headers| may be null in the response + // for certain protocol, or without network connection. + bool did_received_response; + + // If the download requires response headers to be persisted. False for older + // proto version. + bool require_response_headers; }; } // namespace download
diff --git a/components/download/internal/background_service/entry_utils.cc b/components/download/internal/background_service/entry_utils.cc index e9d71ba..41cec5c 100644 --- a/components/download/internal/background_service/entry_utils.cc +++ b/components/download/internal/background_service/entry_utils.cc
@@ -94,9 +94,8 @@ meta_data.guid = entry->guid; if (entry->state == Entry::State::COMPLETE) { meta_data.completion_info = - CompletionInfo(entry->target_file_path, entry->bytes_downloaded); - meta_data.completion_info->response_headers = entry->response_headers; - meta_data.completion_info->url_chain = entry->url_chain; + CompletionInfo(entry->target_file_path, entry->bytes_downloaded, + entry->url_chain, entry->response_headers); // If the download is completed, the |current_size| needs to pull from entry // since the history db record has been deleted. meta_data.current_size = entry->bytes_downloaded;
diff --git a/components/download/internal/background_service/in_memory_download_driver.cc b/components/download/internal/background_service/in_memory_download_driver.cc index e737cce..790611b 100644 --- a/components/download/internal/background_service/in_memory_download_driver.cc +++ b/components/download/internal/background_service/in_memory_download_driver.cc
@@ -110,7 +110,7 @@ download_ptr->Start(); } -void InMemoryDownloadDriver::Remove(const std::string& guid) { +void InMemoryDownloadDriver::Remove(const std::string& guid, bool remove_file) { downloads_.erase(guid); }
diff --git a/components/download/internal/background_service/in_memory_download_driver.h b/components/download/internal/background_service/in_memory_download_driver.h index f7e112b5..ebd3e12 100644 --- a/components/download/internal/background_service/in_memory_download_driver.h +++ b/components/download/internal/background_service/in_memory_download_driver.h
@@ -64,7 +64,7 @@ const base::FilePath& file_path, scoped_refptr<network::ResourceRequestBody> post_body, const net::NetworkTrafficAnnotationTag& traffic_annotation) override; - void Remove(const std::string& guid) override; + void Remove(const std::string& guid, bool remove_file) override; void Pause(const std::string& guid) override; void Resume(const std::string& guid) override; base::Optional<DriverEntry> Find(const std::string& guid) override;
diff --git a/components/download/internal/background_service/in_memory_download_driver_unittest.cc b/components/download/internal/background_service/in_memory_download_driver_unittest.cc index 6eccc97..e67f80a 100644 --- a/components/download/internal/background_service/in_memory_download_driver_unittest.cc +++ b/components/download/internal/background_service/in_memory_download_driver_unittest.cc
@@ -163,7 +163,7 @@ EXPECT_EQ(guid, entry->guid); EXPECT_EQ(DriverEntry::State::COMPLETE, entry->state); - driver()->Remove(guid); + driver()->Remove(guid, false); entry = driver()->Find(guid); EXPECT_FALSE(entry.has_value()); }
diff --git a/components/download/internal/background_service/proto/entry.proto b/components/download/internal/background_service/proto/entry.proto index b810cb44..1c14eb9 100644 --- a/components/download/internal/background_service/proto/entry.proto +++ b/components/download/internal/background_service/proto/entry.proto
@@ -71,4 +71,6 @@ repeated string url_chain = 16; optional string response_headers = 17; + optional bool did_received_response = 18; + optional bool require_response_headers = 19; }
diff --git a/components/download/internal/background_service/proto_conversions.cc b/components/download/internal/background_service/proto_conversions.cc index 1c666fe..2ee11fac 100644 --- a/components/download/internal/background_service/proto_conversions.cc +++ b/components/download/internal/background_service/proto_conversions.cc
@@ -296,6 +296,8 @@ base::MakeRefCounted<const net::HttpResponseHeaders>( proto.response_headers()); } + entry.did_received_response = proto.did_received_response(); + entry.require_response_headers = proto.require_response_headers(); return entry; } @@ -324,6 +326,9 @@ proto.add_url_chain(url.spec()); if (entry.response_headers) proto.set_response_headers(entry.response_headers->raw_headers()); + proto.set_did_received_response(entry.did_received_response); + proto.set_require_response_headers(entry.require_response_headers); + return proto; }
diff --git a/components/download/internal/background_service/test/entry_utils.cc b/components/download/internal/background_service/test/entry_utils.cc index 46df0d21..2bfecd7 100644 --- a/components/download/internal/background_service/test/entry_utils.cc +++ b/components/download/internal/background_service/test/entry_utils.cc
@@ -54,6 +54,7 @@ entry.response_headers = base::MakeRefCounted<const net::HttpResponseHeaders>( "HTTP/1.1 200 OK\nContent-type: text/html\n\n"); + entry.did_received_response = true; } return entry; } @@ -103,6 +104,7 @@ entry.url_chain = {url, url}; entry.response_headers = base::MakeRefCounted<const net::HttpResponseHeaders>( "HTTP/1.1 200 OK\nContent-type: text/html\n\n"); + entry.did_received_response = true; return entry; }
diff --git a/components/download/internal/background_service/test/test_download_driver.cc b/components/download/internal/background_service/test/test_download_driver.cc index 54634cf..7185b2e 100644 --- a/components/download/internal/background_service/test/test_download_driver.cc +++ b/components/download/internal/background_service/test/test_download_driver.cc
@@ -81,6 +81,7 @@ entry.paused = false; entry.bytes_downloaded = 0; entry.expected_total_size = 0; + entry.url_chain = {params.url}; entry.response_headers = base::MakeRefCounted<net::HttpResponseHeaders>("HTTP/1.1 200"); entries_[guid] = entry; @@ -89,7 +90,7 @@ client_->OnDownloadCreated(entry); } -void TestDownloadDriver::Remove(const std::string& guid) { +void TestDownloadDriver::Remove(const std::string& guid, bool remove_file) { entries_.erase(guid); }
diff --git a/components/download/internal/background_service/test/test_download_driver.h b/components/download/internal/background_service/test/test_download_driver.h index 34b4e86..750c59a 100644 --- a/components/download/internal/background_service/test/test_download_driver.h +++ b/components/download/internal/background_service/test/test_download_driver.h
@@ -44,7 +44,7 @@ const base::FilePath& file_path, scoped_refptr<network::ResourceRequestBody> post_body, const net::NetworkTrafficAnnotationTag& traffic_annotation) override; - void Remove(const std::string& guid) override; + void Remove(const std::string& guid, bool remove_file) override; void Pause(const std::string& guid) override; void Resume(const std::string& guid) override; base::Optional<DriverEntry> Find(const std::string& guid) override;
diff --git a/components/download/public/background_service/download_metadata.cc b/components/download/public/background_service/download_metadata.cc index 9beca125..51ba272 100644 --- a/components/download/public/background_service/download_metadata.cc +++ b/components/download/public/background_service/download_metadata.cc
@@ -4,11 +4,28 @@ #include "components/download/public/background_service/download_metadata.h" +namespace { + +bool AreResponseHeadersEqual(const net::HttpResponseHeaders* h1, + const net::HttpResponseHeaders* h2) { + if (h1 && h2) + return h1->raw_headers() == h2->raw_headers(); + return !h1 && !h2; +} + +} // namespace + namespace download { -CompletionInfo::CompletionInfo(const base::FilePath& path, - uint64_t bytes_downloaded) - : path(path), bytes_downloaded(bytes_downloaded) {} +CompletionInfo::CompletionInfo( + const base::FilePath& path, + uint64_t bytes_downloaded, + const std::vector<GURL>& url_chain, + scoped_refptr<const net::HttpResponseHeaders> response_headers) + : path(path), + bytes_downloaded(bytes_downloaded), + url_chain(url_chain), + response_headers(std::move(response_headers)) {} CompletionInfo::CompletionInfo(const CompletionInfo& other) = default; @@ -16,7 +33,10 @@ bool CompletionInfo::operator==(const CompletionInfo& other) const { // The blob data handle is not compared here. - return path == other.path && bytes_downloaded == other.bytes_downloaded; + return path == other.path && bytes_downloaded == other.bytes_downloaded && + url_chain == other.url_chain && + AreResponseHeadersEqual(response_headers.get(), + other.response_headers.get()); } DownloadMetaData::DownloadMetaData() : current_size(0u) {}
diff --git a/components/download/public/background_service/download_metadata.h b/components/download/public/background_service/download_metadata.h index f264d39..59683b4 100644 --- a/components/download/public/background_service/download_metadata.h +++ b/components/download/public/background_service/download_metadata.h
@@ -40,7 +40,11 @@ // account changed values during retries/resumptions. scoped_refptr<const net::HttpResponseHeaders> response_headers; - CompletionInfo(const base::FilePath& path, uint64_t bytes_downloaded); + CompletionInfo( + const base::FilePath& path, + uint64_t bytes_downloaded, + const std::vector<GURL>& url_chain, + scoped_refptr<const net::HttpResponseHeaders> response_headers); CompletionInfo(const CompletionInfo& other); ~CompletionInfo(); bool operator==(const CompletionInfo& other) const;
diff --git a/components/download/public/background_service/test/test_download_service.cc b/components/download/public/background_service/test/test_download_service.cc index 28a8301..a66033c 100644 --- a/components/download/public/background_service/test/test_download_service.cc +++ b/components/download/public/background_service/test/test_download_service.cc
@@ -138,7 +138,8 @@ if (!failed_download_id_.empty() && params.guid == failed_download_id_) { OnDownloadFailed(params.guid, Client::FailureReason::ABORTED); } else { - CompletionInfo completion_info(base::FilePath(), file_size_); + CompletionInfo completion_info(base::FilePath(), file_size_, + {params.request_params.url}, nullptr); OnDownloadSucceeded(params.guid, completion_info); } }
diff --git a/components/download/public/common/download_item.h b/components/download/public/common/download_item.h index b4ae750b..dae2058 100644 --- a/components/download/public/common/download_item.h +++ b/components/download/public/common/download_item.h
@@ -347,7 +347,7 @@ // If the file is successfully deleted, then GetFileExternallyRemoved() will // become true, GetFullPath() will become empty, and // DownloadItem::OnDownloadUpdated() will be called. Does nothing if - // GetState() == COMPLETE or GetFileExternallyRemoved() is already true or + // GetState() != COMPLETE or GetFileExternallyRemoved() is already true or // GetFullPath() is already empty. The callback is always run, and it is // always run asynchronously. It will be passed true if the file is // successfully deleted or if GetFilePath() was already empty or if
diff --git a/components/feed/content/feed_offline_host.cc b/components/feed/content/feed_offline_host.cc index 3e84027..19006056 100644 --- a/components/feed/content/feed_offline_host.cc +++ b/components/feed/content/feed_offline_host.cc
@@ -122,10 +122,10 @@ DCHECK(prefetch_service_); DCHECK(!on_suggestion_consumed_.is_null()); DCHECK(!on_suggestions_shown_.is_null()); - offline_page_model_->AddObserver(this); } FeedOfflineHost::~FeedOfflineHost() { + // Safe to call RemoveObserver() even if AddObserver() has not been called. offline_page_model_->RemoveObserver(this); } @@ -133,9 +133,12 @@ const base::RepeatingClosure& trigger_get_known_content, const NotifyStatusChangeCallback& notify_status_change) { DCHECK(trigger_get_known_content_.is_null()); + DCHECK(!trigger_get_known_content.is_null()); DCHECK(notify_status_change_.is_null()); + DCHECK(!notify_status_change.is_null()); trigger_get_known_content_ = trigger_get_known_content; notify_status_change_ = notify_status_change; + offline_page_model_->AddObserver(this); // TODO(skym): Post task to call PrefetchService::SetSuggestionProvider(). } @@ -190,6 +193,7 @@ void FeedOfflineHost::GetCurrentArticleSuggestions( SuggestionsProvider::SuggestionCallback suggestions_callback) { + DCHECK(!trigger_get_known_content_.is_null()); pending_known_content_callbacks_.push_back(base::BindOnce( &RunSuggestionCallbackWithConversion, std::move(suggestions_callback))); // Trigger after push_back() in case triggering results in a synchronous @@ -213,6 +217,7 @@ void FeedOfflineHost::OfflinePageAdded(OfflinePageModel* model, const OfflinePageItem& added_page) { + DCHECK(!notify_status_change_.is_null()); const std::string& url = PreferOriginal(added_page).spec(); CacheOfflinePageUrlAndId(url, added_page.offline_id); notify_status_change_.Run(url, true); @@ -220,6 +225,7 @@ void FeedOfflineHost::OfflinePageDeleted( const OfflinePageModel::DeletedPageInfo& page_info) { + DCHECK(!notify_status_change_.is_null()); const std::string& url = page_info.url.spec(); EvictOfflinePageUrl(url); notify_status_change_.Run(url, false);
diff --git a/components/feed/content/feed_offline_host_unittest.cc b/components/feed/content/feed_offline_host_unittest.cc index fbcf610..70ae6e4 100644 --- a/components/feed/content/feed_offline_host_unittest.cc +++ b/components/feed/content/feed_offline_host_unittest.cc
@@ -102,6 +102,7 @@ public: TestOfflinePageModel* offline_page_model() { return &offline_page_model_; } FeedOfflineHost* host() { return host_.get(); } + StubPrefetchService* prefetch_service() { return &prefetch_service_; } int get_suggestion_consumed_count() { return suggestion_consumed_count_; } int get_suggestions_shown_count() { return suggestions_shown_count_; } int get_get_known_content_count() { return get_known_content_count_; } @@ -111,16 +112,27 @@ void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } - void ResetHost() { - EXPECT_CALL(*offline_page_model(), AddObserver(testing::_)).Times(1); - EXPECT_CALL(*offline_page_model(), RemoveObserver(testing::_)).Times(1); + void SetupHost() { + EXPECT_CALL(*offline_page_model(), AddObserver(testing::_)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL(*offline_page_model(), RemoveObserver(testing::_)) + .Times(1) + .RetiresOnSaturation(); + ResetHost(); + InitHost(); + } + void ResetHost() { host_ = std::make_unique<FeedOfflineHost>( - &offline_page_model_, &prefetch_service_, + offline_page_model(), prefetch_service(), base::BindRepeating(&FeedOfflineHostTest::OnSuggestionConsumed, base::Unretained(this)), base::BindRepeating(&FeedOfflineHostTest::OnSuggestionsShown, base::Unretained(this))); + } + + void InitHost() { host()->Initialize( base::BindRepeating(&FeedOfflineHostTest::OnGetKnownContentRequested, base::Unretained(this)), @@ -129,7 +141,7 @@ } protected: - FeedOfflineHostTest() { ResetHost(); } + FeedOfflineHostTest() { SetupHost(); } private: void OnSuggestionConsumed() { ++suggestion_consumed_count_; } @@ -354,4 +366,13 @@ EXPECT_FALSE(host()->GetOfflineId(kUrl1).has_value()); } +TEST_F(FeedOfflineHostTest, NoAddObserverWithoutInitialize) { + // Normally SetupHost() will set all observer expectations. Here we explicitly + // do not expect AddObserver and then reset the host. + EXPECT_CALL(*offline_page_model(), RemoveObserver(testing::_)) + .Times(1) + .RetiresOnSaturation(); + ResetHost(); +} + } // namespace feed
diff --git a/components/keyed_service/content/browser_context_keyed_service_factory.cc b/components/keyed_service/content/browser_context_keyed_service_factory.cc index dbcbebcc..acfd882a 100644 --- a/components/keyed_service/content/browser_context_keyed_service_factory.cc +++ b/components/keyed_service/content/browser_context_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "components/keyed_service/content/browser_context_keyed_service_factory.h" +#include "base/bind.h" #include "base/logging.h" #include "base/memory/ptr_util.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" @@ -15,25 +16,34 @@ void BrowserContextKeyedServiceFactory::SetTestingFactory( content::BrowserContext* context, TestingFactoryFunction testing_factory) { - KeyedServiceFactory::TestingFactoryFunction func; + KeyedServiceFactory::TestingFactory wrapped_factory; if (testing_factory) { - func = [=](base::SupportsUserData* context) { - return testing_factory(static_cast<content::BrowserContext*>(context)); - }; + wrapped_factory = base::BindRepeating( + [](TestingFactoryFunction testing_factory, + base::SupportsUserData* context) { + return testing_factory( + static_cast<content::BrowserContext*>(context)); + }, + testing_factory); } - KeyedServiceFactory::SetTestingFactory(context, func); + KeyedServiceFactory::SetTestingFactory(context, std::move(wrapped_factory)); } KeyedService* BrowserContextKeyedServiceFactory::SetTestingFactoryAndUse( content::BrowserContext* context, TestingFactoryFunction testing_factory) { - KeyedServiceFactory::TestingFactoryFunction func; + KeyedServiceFactory::TestingFactory wrapped_factory; if (testing_factory) { - func = [=](base::SupportsUserData* context) { - return testing_factory(static_cast<content::BrowserContext*>(context)); - }; + wrapped_factory = base::BindRepeating( + [](TestingFactoryFunction testing_factory, + base::SupportsUserData* context) { + return testing_factory( + static_cast<content::BrowserContext*>(context)); + }, + testing_factory); } - return KeyedServiceFactory::SetTestingFactoryAndUse(context, func); + return KeyedServiceFactory::SetTestingFactoryAndUse( + context, std::move(wrapped_factory)); } BrowserContextKeyedServiceFactory::BrowserContextKeyedServiceFactory(
diff --git a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc index 92507d3..ad23f57 100644 --- a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc +++ b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h" +#include "base/bind.h" #include "base/logging.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/core/refcounted_keyed_service.h" @@ -12,26 +13,36 @@ void RefcountedBrowserContextKeyedServiceFactory::SetTestingFactory( content::BrowserContext* context, TestingFactoryFunction testing_factory) { - RefcountedKeyedServiceFactory::TestingFactoryFunction func; + RefcountedKeyedServiceFactory::TestingFactory wrapped_factory; if (testing_factory) { - func = [=](base::SupportsUserData* context) { - return testing_factory(static_cast<content::BrowserContext*>(context)); - }; + wrapped_factory = base::BindRepeating( + [](TestingFactoryFunction testing_factory, + base::SupportsUserData* context) { + return testing_factory( + static_cast<content::BrowserContext*>(context)); + }, + testing_factory); } - RefcountedKeyedServiceFactory::SetTestingFactory(context, func); + RefcountedKeyedServiceFactory::SetTestingFactory(context, + std::move(wrapped_factory)); } scoped_refptr<RefcountedKeyedService> RefcountedBrowserContextKeyedServiceFactory::SetTestingFactoryAndUse( content::BrowserContext* context, TestingFactoryFunction testing_factory) { - RefcountedKeyedServiceFactory::TestingFactoryFunction func; + RefcountedKeyedServiceFactory::TestingFactory wrapped_factory; if (testing_factory) { - func = [=](base::SupportsUserData* context) { - return testing_factory(static_cast<content::BrowserContext*>(context)); - }; + wrapped_factory = base::BindRepeating( + [](TestingFactoryFunction testing_factory, + base::SupportsUserData* context) { + return testing_factory( + static_cast<content::BrowserContext*>(context)); + }, + testing_factory); } - return RefcountedKeyedServiceFactory::SetTestingFactoryAndUse(context, func); + return RefcountedKeyedServiceFactory::SetTestingFactoryAndUse( + context, std::move(wrapped_factory)); } RefcountedBrowserContextKeyedServiceFactory::
diff --git a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h index 8df82eaa..50c7043 100644 --- a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h +++ b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h
@@ -33,7 +33,7 @@ // A function that supplies the instance of a KeyedService for a given // BrowserContext. This is used primarily for testing, where we want to feed // a specific mock into the BCKSF system. - typedef scoped_refptr<RefcountedKeyedService>(*TestingFactoryFunction)( + using TestingFactoryFunction = scoped_refptr<RefcountedKeyedService> (*)( content::BrowserContext* context); // Associates |factory| with |context| so that |factory| is used to create
diff --git a/components/keyed_service/core/keyed_service_factory.cc b/components/keyed_service/core/keyed_service_factory.cc index e93b1421..eff4e3d2 100644 --- a/components/keyed_service/core/keyed_service_factory.cc +++ b/components/keyed_service/core/keyed_service_factory.cc
@@ -21,9 +21,8 @@ DCHECK(mapping_.empty()); } -void KeyedServiceFactory::SetTestingFactory( - base::SupportsUserData* context, - TestingFactoryFunction testing_factory) { +void KeyedServiceFactory::SetTestingFactory(base::SupportsUserData* context, + TestingFactory testing_factory) { // Destroying the context may cause us to lose data about whether |context| // has our preferences registered on it (since the context object itself // isn't dead). See if we need to readd it once we've gone through normal @@ -45,14 +44,14 @@ if (add_context) MarkPreferencesSetOn(context); - testing_factories_[context] = testing_factory; + testing_factories_.emplace(context, std::move(testing_factory)); } KeyedService* KeyedServiceFactory::SetTestingFactoryAndUse( base::SupportsUserData* context, - TestingFactoryFunction testing_factory) { + TestingFactory testing_factory) { DCHECK(testing_factory); - SetTestingFactory(context, testing_factory); + SetTestingFactory(context, std::move(testing_factory)); return GetServiceForContext(context, true); } @@ -66,9 +65,9 @@ // NOTE: If you modify any of the logic below, make sure to update the // refcounted version in refcounted_context_keyed_service_factory.cc! - const auto& it = mapping_.find(context); - if (it != mapping_.end()) - return it->second; + auto iterator = mapping_.find(context); + if (iterator != mapping_.end()) + return iterator->second.get(); // Object not found. if (!create) @@ -78,39 +77,38 @@ // Check to see if we have a per-context testing factory that we should use // instead of default behavior. std::unique_ptr<KeyedService> service; - const auto& jt = testing_factories_.find(context); - if (jt != testing_factories_.end()) { - if (jt->second) { + auto factory_iterator = testing_factories_.find(context); + if (factory_iterator != testing_factories_.end()) { + if (factory_iterator->second) { if (!IsOffTheRecord(context)) RegisterUserPrefsOnContextForTest(context); - service = jt->second(context); + service = factory_iterator->second.Run(context); } } else { service = BuildServiceInstanceFor(context); } - Associate(context, std::move(service)); - return mapping_[context]; + return Associate(context, std::move(service)); } -void KeyedServiceFactory::Associate(base::SupportsUserData* context, - std::unique_ptr<KeyedService> service) { +KeyedService* KeyedServiceFactory::Associate( + base::SupportsUserData* context, + std::unique_ptr<KeyedService> service) { DCHECK(!base::ContainsKey(mapping_, context)); - mapping_.insert(std::make_pair(context, service.release())); + auto iterator = mapping_.emplace(context, std::move(service)).first; + return iterator->second.get(); } void KeyedServiceFactory::Disassociate(base::SupportsUserData* context) { - const auto& it = mapping_.find(context); - if (it != mapping_.end()) { - delete it->second; - mapping_.erase(it); - } + auto iterator = mapping_.find(context); + if (iterator != mapping_.end()) + mapping_.erase(iterator); } void KeyedServiceFactory::ContextShutdown(base::SupportsUserData* context) { - const auto& it = mapping_.find(context); - if (it != mapping_.end() && it->second) - it->second->Shutdown(); + auto iterator = mapping_.find(context); + if (iterator != mapping_.end() && iterator->second) + iterator->second->Shutdown(); } void KeyedServiceFactory::ContextDestroyed(base::SupportsUserData* context) { @@ -127,11 +125,11 @@ void KeyedServiceFactory::SetEmptyTestingFactory( base::SupportsUserData* context) { - SetTestingFactory(context, nullptr); + SetTestingFactory(context, TestingFactory()); } bool KeyedServiceFactory::HasTestingFactory(base::SupportsUserData* context) { - return testing_factories_.find(context) != testing_factories_.end(); + return base::ContainsKey(testing_factories_, context); } void KeyedServiceFactory::CreateServiceNow(base::SupportsUserData* context) {
diff --git a/components/keyed_service/core/keyed_service_factory.h b/components/keyed_service/core/keyed_service_factory.h index c2562001..cc82b15 100644 --- a/components/keyed_service/core/keyed_service_factory.h +++ b/components/keyed_service/core/keyed_service_factory.h
@@ -30,25 +30,24 @@ KeyedServiceFactory(const char* name, DependencyManager* manager); ~KeyedServiceFactory() override; - // A function that supplies the instance of a KeyedService for a given + // A callback that supplies the instance of a KeyedService for a given // |context|. This is used primarily for testing, where we want to feed - // a specific mock into the KeyedServiceFactory system. - typedef std::function<std::unique_ptr<KeyedService>( - base::SupportsUserData* context)> - TestingFactoryFunction; + // a specific test double into the KeyedServiceFactory system. + using TestingFactory = base::RepeatingCallback<std::unique_ptr<KeyedService>( + base::SupportsUserData* context)>; - // Associates |factory| with |context| so that |factory| is used to create - // the KeyedService when requested. |factory| can be NULL to signal that - // KeyedService should be NULL. Multiple calls to SetTestingFactory() are - // allowed; previous services will be shut down. + // Associates |testing_factory| with |context| so that |testing_factory| is + // used to create the KeyedService when requested. |testing_factory| can be + // empty to signal that KeyedService should be null. Multiple calls to + // SetTestingFactory() are allowed; previous services will be shut down. void SetTestingFactory(base::SupportsUserData* context, - TestingFactoryFunction factory); + TestingFactory testing_factory); - // Associates |factory| with |context| and immediately returns the created - // KeyedService. Since the factory will be used immediately, it may not be - // NULL. + // Associates |testing_factory| with |context| and immediately returns the + // created KeyedService. Since the factory will be used immediately, it may + // not be empty. KeyedService* SetTestingFactoryAndUse(base::SupportsUserData* context, - TestingFactoryFunction factory); + TestingFactory testing_factory); // Common implementation that maps |context| to some service object. Deals // with incognito contexts per subclass instructions with GetContextToUse() @@ -57,9 +56,10 @@ KeyedService* GetServiceForContext(base::SupportsUserData* context, bool create); - // Maps |context| to |service| with debug checks to prevent duplication. - void Associate(base::SupportsUserData* context, - std::unique_ptr<KeyedService> service); + // Maps |context| to |service| with debug checks to prevent duplication and + // returns a raw pointer to |service|. + KeyedService* Associate(base::SupportsUserData* context, + std::unique_ptr<KeyedService> service); // Removes the mapping from |context| to a service. void Disassociate(base::SupportsUserData* context); @@ -83,16 +83,11 @@ friend class DependencyManager; friend class DependencyManagerUnittests; - typedef std::map<base::SupportsUserData*, KeyedService*> KeyedServices; - typedef std::map<base::SupportsUserData*, TestingFactoryFunction> - OverriddenTestingFunctions; - // The mapping between a context and its service. - KeyedServices mapping_; + std::map<base::SupportsUserData*, std::unique_ptr<KeyedService>> mapping_; - // The mapping between a context and its overridden - // TestingFactoryFunction. - OverriddenTestingFunctions testing_factories_; + // The mapping between a context and its overridden TestingFactory. + std::map<base::SupportsUserData*, TestingFactory> testing_factories_; DISALLOW_COPY_AND_ASSIGN(KeyedServiceFactory); };
diff --git a/components/keyed_service/core/refcounted_keyed_service_factory.cc b/components/keyed_service/core/refcounted_keyed_service_factory.cc index 7afecda..f7c4f9c6 100644 --- a/components/keyed_service/core/refcounted_keyed_service_factory.cc +++ b/components/keyed_service/core/refcounted_keyed_service_factory.cc
@@ -21,7 +21,7 @@ void RefcountedKeyedServiceFactory::SetTestingFactory( base::SupportsUserData* context, - TestingFactoryFunction testing_factory) { + TestingFactory testing_factory) { // Destroying the context may cause us to lose data about whether |context| // has our preferences registered on it (since the context object itself // isn't dead). See if we need to readd it once we've gone through normal @@ -43,15 +43,15 @@ if (add_context) MarkPreferencesSetOn(context); - testing_factories_[context] = testing_factory; + testing_factories_.emplace(context, std::move(testing_factory)); } scoped_refptr<RefcountedKeyedService> RefcountedKeyedServiceFactory::SetTestingFactoryAndUse( base::SupportsUserData* context, - TestingFactoryFunction testing_factory) { + TestingFactory testing_factory) { DCHECK(testing_factory); - SetTestingFactory(context, testing_factory); + SetTestingFactory(context, std::move(testing_factory)); return GetServiceForContext(context, true); } @@ -65,9 +65,9 @@ // NOTE: If you modify any of the logic below, make sure to update the // non-refcounted version in context_keyed_service_factory.cc! - const auto& it = mapping_.find(context); - if (it != mapping_.end()) - return it->second; + auto iterator = mapping_.find(context); + if (iterator != mapping_.end()) + return iterator->second; // Object not found. if (!create) @@ -77,40 +77,47 @@ // Check to see if we have a per-BrowserContext testing factory that we should // use instead of default behavior. scoped_refptr<RefcountedKeyedService> service; - const auto& jt = testing_factories_.find(context); - if (jt != testing_factories_.end()) { - if (jt->second) { + auto factory_iterator = testing_factories_.find(context); + if (factory_iterator != testing_factories_.end()) { + if (factory_iterator->second) { if (!IsOffTheRecord(context)) RegisterUserPrefsOnContextForTest(context); - service = jt->second(context); + service = factory_iterator->second.Run(context); } } else { service = BuildServiceInstanceFor(context); } - Associate(context, service); - return service; + return Associate(context, std::move(service)); } -void RefcountedKeyedServiceFactory::Associate( +scoped_refptr<RefcountedKeyedService> RefcountedKeyedServiceFactory::Associate( base::SupportsUserData* context, - const scoped_refptr<RefcountedKeyedService>& service) { + scoped_refptr<RefcountedKeyedService> service) { DCHECK(!base::ContainsKey(mapping_, context)); - mapping_.insert(std::make_pair(context, service)); + auto iterator = mapping_.emplace(context, std::move(service)).first; + return iterator->second; +} + +void RefcountedKeyedServiceFactory::Disassociate( + base::SupportsUserData* context) { + // We "merely" drop our reference to the service. Hopefully this will cause + // the service to be destroyed. If not, oh well. + auto iterator = mapping_.find(context); + if (iterator != mapping_.end()) + mapping_.erase(iterator); } void RefcountedKeyedServiceFactory::ContextShutdown( base::SupportsUserData* context) { - const auto& it = mapping_.find(context); - if (it != mapping_.end() && it->second.get()) - it->second->ShutdownOnUIThread(); + auto iterator = mapping_.find(context); + if (iterator != mapping_.end() && iterator->second.get()) + iterator->second->ShutdownOnUIThread(); } void RefcountedKeyedServiceFactory::ContextDestroyed( base::SupportsUserData* context) { - // We "merely" drop our reference to the service. Hopefully this will cause - // the service to be destroyed. If not, oh well. - mapping_.erase(context); + Disassociate(context); // For unit tests, we also remove the factory function both so we don't // maintain a big map of dead pointers, but also since we may have a second @@ -123,12 +130,12 @@ void RefcountedKeyedServiceFactory::SetEmptyTestingFactory( base::SupportsUserData* context) { - SetTestingFactory(context, nullptr); + SetTestingFactory(context, TestingFactory()); } bool RefcountedKeyedServiceFactory::HasTestingFactory( base::SupportsUserData* context) { - return testing_factories_.find(context) != testing_factories_.end(); + return base::ContainsKey(testing_factories_, context); } void RefcountedKeyedServiceFactory::CreateServiceNow(
diff --git a/components/keyed_service/core/refcounted_keyed_service_factory.h b/components/keyed_service/core/refcounted_keyed_service_factory.h index 5a8a4b0f..7641934 100644 --- a/components/keyed_service/core/refcounted_keyed_service_factory.h +++ b/components/keyed_service/core/refcounted_keyed_service_factory.h
@@ -29,26 +29,26 @@ RefcountedKeyedServiceFactory(const char* name, DependencyManager* manager); ~RefcountedKeyedServiceFactory() override; - // A function that supplies the instance of a KeyedService for a given + // A callback that supplies the instance of a KeyedService for a given // |context|. This is used primarily for testing, where we want to feed - // a specific mock into the KeyedServiceFactory system. - typedef std::function<scoped_refptr<RefcountedKeyedService>( - base::SupportsUserData* context)> - TestingFactoryFunction; + // a specific test double into the KeyedServiceFactory system. + using TestingFactory = + base::RepeatingCallback<scoped_refptr<RefcountedKeyedService>( + base::SupportsUserData* context)>; - // Associates |factory| with |context| so that |factory| is used to create - // the KeyedService when requested. |factory| can be NULL to signal that - // KeyedService should be NULL. Multiple calls to SetTestingFactory() are - // allowed; previous services will be shut down. + // Associates |testing_factory| with |context| so that |testing_factory| is + // used to create the KeyedService when requested. |testing_factory| can be + // empty to signal that KeyedService should be null. Multiple calls to + // SetTestingFactory() are allowed; previous services will be shut down. void SetTestingFactory(base::SupportsUserData* context, - TestingFactoryFunction factory); + TestingFactory testing_factory); - // Associates |factory| with |context| and immediately returns the created - // KeyedService. Since the factory will be used immediately, it may not be - // NULL. + // Associates |testing_factory| with |context| and immediately returns the + // created KeyedService. Since the factory will be used immediately, it may + // not be empty. scoped_refptr<RefcountedKeyedService> SetTestingFactoryAndUse( base::SupportsUserData* context, - TestingFactoryFunction factory); + TestingFactory testing_factory); // Common implementation that maps |context| to some service object. Deals // with incognito contexts per subclass instructions with GetContextToUse() @@ -58,9 +58,14 @@ base::SupportsUserData* context, bool create); - // Maps |context| to |service| with debug checks to prevent duplication. - void Associate(base::SupportsUserData* context, - const scoped_refptr<RefcountedKeyedService>& service); + // Maps |context| to |service| with debug checks to prevent duplication and + // returns |service|. + scoped_refptr<RefcountedKeyedService> Associate( + base::SupportsUserData* context, + scoped_refptr<RefcountedKeyedService> service); + + // Removes the mapping from |context| to a service. + void Disassociate(base::SupportsUserData* context); // Returns a new RefcountedKeyedService that will be associated with // |context|. @@ -79,17 +84,12 @@ void CreateServiceNow(base::SupportsUserData* context) override; private: - typedef std::map<base::SupportsUserData*, - scoped_refptr<RefcountedKeyedService>> KeyedServices; - typedef std::map<base::SupportsUserData*, TestingFactoryFunction> - OverriddenTestingFunctions; - // The mapping between a context and its refcounted service. - KeyedServices mapping_; + std::map<base::SupportsUserData*, scoped_refptr<RefcountedKeyedService>> + mapping_; - // The mapping between a context and its overridden - // TestingFactoryFunction. - OverriddenTestingFunctions testing_factories_; + // The mapping between a context and its overridden TestingFactory. + std::map<base::SupportsUserData*, TestingFactory> testing_factories_; DISALLOW_COPY_AND_ASSIGN(RefcountedKeyedServiceFactory); };
diff --git a/components/keyed_service/ios/browser_state_keyed_service_factory.cc b/components/keyed_service/ios/browser_state_keyed_service_factory.cc index 8b9f54f..6d7990e 100644 --- a/components/keyed_service/ios/browser_state_keyed_service_factory.cc +++ b/components/keyed_service/ios/browser_state_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" +#include "base/bind.h" #include "base/logging.h" #include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" @@ -12,25 +13,32 @@ void BrowserStateKeyedServiceFactory::SetTestingFactory( web::BrowserState* context, TestingFactoryFunction testing_factory) { - KeyedServiceFactory::TestingFactoryFunction func; + KeyedServiceFactory::TestingFactory wrapped_factory; if (testing_factory) { - func = [=](base::SupportsUserData* context) { - return testing_factory(static_cast<web::BrowserState*>(context)); - }; + wrapped_factory = base::BindRepeating( + [](TestingFactoryFunction testing_factory, + base::SupportsUserData* context) { + return testing_factory(static_cast<web::BrowserState*>(context)); + }, + testing_factory); } - KeyedServiceFactory::SetTestingFactory(context, func); + KeyedServiceFactory::SetTestingFactory(context, std::move(wrapped_factory)); } KeyedService* BrowserStateKeyedServiceFactory::SetTestingFactoryAndUse( web::BrowserState* context, TestingFactoryFunction testing_factory) { - KeyedServiceFactory::TestingFactoryFunction func; + KeyedServiceFactory::TestingFactory wrapped_factory; if (testing_factory) { - func = [=](base::SupportsUserData* context) { - return testing_factory(static_cast<web::BrowserState*>(context)); - }; + wrapped_factory = base::BindRepeating( + [](TestingFactoryFunction testing_factory, + base::SupportsUserData* context) { + return testing_factory(static_cast<web::BrowserState*>(context)); + }, + testing_factory); } - return KeyedServiceFactory::SetTestingFactoryAndUse(context, func); + return KeyedServiceFactory::SetTestingFactoryAndUse( + context, std::move(wrapped_factory)); } BrowserStateKeyedServiceFactory::BrowserStateKeyedServiceFactory(
diff --git a/components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.cc b/components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.cc index 9d32ff1..45cc3f4 100644 --- a/components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.cc +++ b/components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.h" +#include "base/bind.h" #include "base/logging.h" #include "components/keyed_service/core/refcounted_keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" @@ -12,26 +13,34 @@ void RefcountedBrowserStateKeyedServiceFactory::SetTestingFactory( web::BrowserState* context, TestingFactoryFunction testing_factory) { - RefcountedKeyedServiceFactory::TestingFactoryFunction func; + RefcountedKeyedServiceFactory::TestingFactory wrapped_factory; if (testing_factory) { - func = [=](base::SupportsUserData* context) { - return testing_factory(static_cast<web::BrowserState*>(context)); - }; + wrapped_factory = base::BindRepeating( + [](TestingFactoryFunction testing_factory, + base::SupportsUserData* context) { + return testing_factory(static_cast<web::BrowserState*>(context)); + }, + testing_factory); } - RefcountedKeyedServiceFactory::SetTestingFactory(context, func); + RefcountedKeyedServiceFactory::SetTestingFactory(context, + std::move(wrapped_factory)); } scoped_refptr<RefcountedKeyedService> RefcountedBrowserStateKeyedServiceFactory::SetTestingFactoryAndUse( web::BrowserState* context, TestingFactoryFunction testing_factory) { - RefcountedKeyedServiceFactory::TestingFactoryFunction func; + RefcountedKeyedServiceFactory::TestingFactory wrapped_factory; if (testing_factory) { - func = [=](base::SupportsUserData* context) { - return testing_factory(static_cast<web::BrowserState*>(context)); - }; + wrapped_factory = base::BindRepeating( + [](TestingFactoryFunction testing_factory, + base::SupportsUserData* context) { + return testing_factory(static_cast<web::BrowserState*>(context)); + }, + testing_factory); } - return RefcountedKeyedServiceFactory::SetTestingFactoryAndUse(context, func); + return RefcountedKeyedServiceFactory::SetTestingFactoryAndUse( + context, std::move(wrapped_factory)); } RefcountedBrowserStateKeyedServiceFactory::
diff --git a/components/offline_pages/core/background/BUILD.gn b/components/offline_pages/core/background/BUILD.gn index 682607b3..102bafe 100644 --- a/components/offline_pages/core/background/BUILD.gn +++ b/components/offline_pages/core/background/BUILD.gn
@@ -50,9 +50,8 @@ "request_queue.cc", "request_queue.h", "request_queue_results.h", + "request_queue_store.cc", "request_queue_store.h", - "request_queue_store_sql.cc", - "request_queue_store_sql.h", "save_page_request.cc", "save_page_request.h", "scheduler.h", @@ -81,15 +80,18 @@ "offliner_stub.h", "request_coordinator_stub_taco.cc", "request_coordinator_stub_taco.h", - "request_queue_in_memory_store.cc", - "request_queue_in_memory_store.h", + "request_queue_task_test_base.cc", + "request_queue_task_test_base.h", "scheduler_stub.cc", "scheduler_stub.h", + "test_request_queue_store.cc", + "test_request_queue_store.h", ] deps = [ ":background_offliner", "//base", + "//base/test:test_support", "//components/offline_items_collection/core/test_support", "//components/offline_pages/core", "//net",
diff --git a/components/offline_pages/core/background/add_request_task_unittest.cc b/components/offline_pages/core/background/add_request_task_unittest.cc index e5e40c5..a2dc2ef 100644 --- a/components/offline_pages/core/background/add_request_task_unittest.cc +++ b/components/offline_pages/core/background/add_request_task_unittest.cc
@@ -7,9 +7,11 @@ #include <memory> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -20,14 +22,12 @@ const GURL kUrl2("http://otherexample.com"); const ClientId kClientId1("download", "1234"); const ClientId kClientId2("download", "5678"); -} // namespace -class AddRequestTaskTest : public testing::Test { +class AddRequestTaskTest : public RequestQueueTaskTestBase { public: AddRequestTaskTest(); - ~AddRequestTaskTest() override; + ~AddRequestTaskTest() override {} - void PumpLoop(); void ClearResults(); void InitializeStore(RequestQueueStore* store); @@ -46,27 +46,16 @@ return requests_; } - private: + protected: void InitializeStoreDone(bool success); bool callback_called_; ItemActionStatus status_; std::vector<std::unique_ptr<SavePageRequest>> requests_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; AddRequestTaskTest::AddRequestTaskTest() - : callback_called_(false), - status_(ItemActionStatus::NOT_FOUND), - task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -AddRequestTaskTest::~AddRequestTaskTest() {} - -void AddRequestTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); -} + : callback_called_(false), status_(ItemActionStatus::NOT_FOUND) {} void AddRequestTaskTest::ClearResults() { callback_called_ = false; @@ -96,12 +85,11 @@ } TEST_F(AddRequestTaskTest, AddSingleRequest) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(&store_); base::Time creation_time = base::Time::Now(); SavePageRequest request_1(kRequestId1, kUrl1, kClientId1, creation_time, true); - AddRequestTask task(&store, request_1, + AddRequestTask task(&store_, request_1, base::BindOnce(&AddRequestTaskTest::AddRequestDone, base::Unretained(this))); task.Run(); @@ -109,8 +97,8 @@ EXPECT_TRUE(callback_called()); EXPECT_EQ(ItemActionStatus::SUCCESS, last_status()); - store.GetRequests(base::BindOnce(&AddRequestTaskTest::GetRequestsCallback, - base::Unretained(this))); + store_.GetRequests(base::BindOnce(&AddRequestTaskTest::GetRequestsCallback, + base::Unretained(this))); PumpLoop(); ASSERT_EQ(1ul, last_requests().size()); EXPECT_EQ(kRequestId1, last_requests().at(0)->request_id()); @@ -121,12 +109,11 @@ } TEST_F(AddRequestTaskTest, AddMultipleRequests) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(&store_); base::Time creation_time_1 = base::Time::Now(); SavePageRequest request_1(kRequestId1, kUrl1, kClientId1, creation_time_1, true); - AddRequestTask task(&store, request_1, + AddRequestTask task(&store_, request_1, base::BindOnce(&AddRequestTaskTest::AddRequestDone, base::Unretained(this))); task.Run(); @@ -138,7 +125,7 @@ base::Time creation_time_2 = base::Time::Now(); SavePageRequest request_2(kRequestId2, kUrl2, kClientId2, creation_time_2, true); - AddRequestTask task_2(&store, request_2, + AddRequestTask task_2(&store_, request_2, base::BindOnce(&AddRequestTaskTest::AddRequestDone, base::Unretained(this))); task_2.Run(); @@ -146,8 +133,8 @@ EXPECT_TRUE(callback_called()); EXPECT_EQ(ItemActionStatus::SUCCESS, last_status()); - store.GetRequests(base::BindOnce(&AddRequestTaskTest::GetRequestsCallback, - base::Unretained(this))); + store_.GetRequests(base::BindOnce(&AddRequestTaskTest::GetRequestsCallback, + base::Unretained(this))); PumpLoop(); ASSERT_EQ(2ul, last_requests().size()); int request_2_index = @@ -161,12 +148,11 @@ } TEST_F(AddRequestTaskTest, AddDuplicateRequest) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(&store_); base::Time creation_time_1 = base::Time::Now(); SavePageRequest request_1(kRequestId1, kUrl1, kClientId1, creation_time_1, true); - AddRequestTask task(&store, request_1, + AddRequestTask task(&store_, request_1, base::BindOnce(&AddRequestTaskTest::AddRequestDone, base::Unretained(this))); task.Run(); @@ -179,7 +165,7 @@ // This was has the same request ID. SavePageRequest request_2(kRequestId1, kUrl2, kClientId2, creation_time_2, true); - AddRequestTask task_2(&store, request_2, + AddRequestTask task_2(&store_, request_2, base::BindOnce(&AddRequestTaskTest::AddRequestDone, base::Unretained(this))); task_2.Run(); @@ -187,10 +173,11 @@ EXPECT_TRUE(callback_called()); EXPECT_EQ(ItemActionStatus::ALREADY_EXISTS, last_status()); - store.GetRequests(base::BindOnce(&AddRequestTaskTest::GetRequestsCallback, - base::Unretained(this))); + store_.GetRequests(base::BindOnce(&AddRequestTaskTest::GetRequestsCallback, + base::Unretained(this))); PumpLoop(); ASSERT_EQ(1ul, last_requests().size()); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/change_requests_state_task_unittest.cc b/components/offline_pages/core/background/change_requests_state_task_unittest.cc index 3354e7e5..6ba1d46 100644 --- a/components/offline_pages/core/background/change_requests_state_task_unittest.cc +++ b/components/offline_pages/core/background/change_requests_state_task_unittest.cc
@@ -7,9 +7,11 @@ #include <memory> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -21,17 +23,12 @@ const GURL kUrl2("http://another-example.com"); const ClientId kClientId1("bookmark", "1234"); const ClientId kClientId2("async", "5678"); -} // namespace -class ChangeRequestsStateTaskTest : public testing::Test { +class ChangeRequestsStateTaskTest : public RequestQueueTaskTestBase { public: - ChangeRequestsStateTaskTest(); - ~ChangeRequestsStateTaskTest() override; + ~ChangeRequestsStateTaskTest() override = default; - void PumpLoop(); - - void InitializeStore(RequestQueueStore* store); - void AddItemsToStore(RequestQueueStore* store); + void AddItemsToStore(); void ChangeRequestsStateCallback( std::unique_ptr<UpdateRequestsResult> result); @@ -42,37 +39,18 @@ void AddRequestDone(ItemActionStatus status); std::unique_ptr<UpdateRequestsResult> result_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; -ChangeRequestsStateTaskTest::ChangeRequestsStateTaskTest() - : task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -ChangeRequestsStateTaskTest::~ChangeRequestsStateTaskTest() {} - -void ChangeRequestsStateTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); -} - -void ChangeRequestsStateTaskTest::InitializeStore(RequestQueueStore* store) { - store->Initialize( - base::BindOnce(&ChangeRequestsStateTaskTest::InitializeStoreDone, - base::Unretained(this))); - PumpLoop(); -} - -void ChangeRequestsStateTaskTest::AddItemsToStore(RequestQueueStore* store) { +void ChangeRequestsStateTaskTest::AddItemsToStore() { base::Time creation_time = base::Time::Now(); SavePageRequest request_1(kRequestId1, kUrl1, kClientId1, creation_time, true); - store->AddRequest(request_1, + store_.AddRequest(request_1, base::BindOnce(&ChangeRequestsStateTaskTest::AddRequestDone, base::Unretained(this))); SavePageRequest request_2(kRequestId2, kUrl2, kClientId2, creation_time, true); - store->AddRequest(request_2, + store_.AddRequest(request_2, base::BindOnce(&ChangeRequestsStateTaskTest::AddRequestDone, base::Unretained(this))); PumpLoop(); @@ -92,12 +70,11 @@ } TEST_F(ChangeRequestsStateTaskTest, UpdateWhenStoreEmpty) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(); std::vector<int64_t> request_ids{kRequestId1}; ChangeRequestsStateTask task( - &store, request_ids, SavePageRequest::RequestState::PAUSED, + &store_, request_ids, SavePageRequest::RequestState::PAUSED, base::BindOnce(&ChangeRequestsStateTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -111,13 +88,12 @@ } TEST_F(ChangeRequestsStateTaskTest, UpdateSingleItem) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddItemsToStore(&store); + InitializeStore(); + AddItemsToStore(); std::vector<int64_t> request_ids{kRequestId1}; ChangeRequestsStateTask task( - &store, request_ids, SavePageRequest::RequestState::PAUSED, + &store_, request_ids, SavePageRequest::RequestState::PAUSED, base::BindOnce(&ChangeRequestsStateTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -133,13 +109,12 @@ } TEST_F(ChangeRequestsStateTaskTest, UpdateMultipleItems) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddItemsToStore(&store); + InitializeStore(); + AddItemsToStore(); std::vector<int64_t> request_ids{kRequestId1, kRequestId2}; ChangeRequestsStateTask task( - &store, request_ids, SavePageRequest::RequestState::PAUSED, + &store_, request_ids, SavePageRequest::RequestState::PAUSED, base::BindOnce(&ChangeRequestsStateTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -173,12 +148,11 @@ } TEST_F(ChangeRequestsStateTaskTest, EmptyRequestsList) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(); std::vector<int64_t> request_ids; ChangeRequestsStateTask task( - &store, request_ids, SavePageRequest::RequestState::PAUSED, + &store_, request_ids, SavePageRequest::RequestState::PAUSED, base::BindOnce(&ChangeRequestsStateTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -189,13 +163,12 @@ } TEST_F(ChangeRequestsStateTaskTest, UpdateMissingItem) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddItemsToStore(&store); + InitializeStore(); + AddItemsToStore(); std::vector<int64_t> request_ids{kRequestId1, kRequestId3}; ChangeRequestsStateTask task( - &store, request_ids, SavePageRequest::RequestState::PAUSED, + &store_, request_ids, SavePageRequest::RequestState::PAUSED, base::BindOnce(&ChangeRequestsStateTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -213,4 +186,5 @@ last_result()->updated_items.at(0).request_state()); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/cleanup_task_unittest.cc b/components/offline_pages/core/background/cleanup_task_unittest.cc index f58f760..3c6b494 100644 --- a/components/offline_pages/core/background/cleanup_task_unittest.cc +++ b/components/offline_pages/core/background/cleanup_task_unittest.cc
@@ -8,15 +8,16 @@ #include <set> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "components/offline_pages/core/background/offliner_policy.h" #include "components/offline_pages/core/background/request_coordinator.h" #include "components/offline_pages/core/background/request_coordinator_event_logger.h" #include "components/offline_pages/core/background/request_notifier.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" #include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" #include "components/offline_pages/core/background/save_page_request.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -38,7 +39,6 @@ ClientId("", ""), base::Time(), true); -} // namespace // TODO: Refactor this stub class into its own file, use in Pick Request Task // Test too. @@ -78,16 +78,13 @@ int32_t total_expired_requests_; }; -class CleanupTaskTest : public testing::Test { +class CleanupTaskTest : public RequestQueueTaskTestBase { public: - CleanupTaskTest(); - - ~CleanupTaskTest() override; + CleanupTaskTest() {} + ~CleanupTaskTest() override {} void SetUp() override; - void PumpLoop(); - void AddRequestDone(ItemActionStatus status); void GetRequestsCallback( @@ -103,16 +100,14 @@ RequestNotifierStub* GetNotifier() { return notifier_.get(); } CleanupTask* task() { return task_.get(); } - RequestQueueStore* store() { return store_.get(); } + RequestQueueStore* store() { return &store_; } OfflinerPolicy* policy() { return policy_.get(); } std::vector<std::unique_ptr<SavePageRequest>>& found_requests() { return found_requests_; } protected: - void InitializeStoreDone(bool success); - std::unique_ptr<RequestQueueStore> store_; std::unique_ptr<RequestNotifierStub> notifier_; std::unique_ptr<SavePageRequest> last_picked_; std::unique_ptr<OfflinerPolicy> policy_; @@ -120,32 +115,15 @@ std::unique_ptr<CleanupTaskFactory> factory_; std::unique_ptr<CleanupTask> task_; std::vector<std::unique_ptr<SavePageRequest>> found_requests_; - - private: - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; -CleanupTaskTest::CleanupTaskTest() - : task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -CleanupTaskTest::~CleanupTaskTest() {} - void CleanupTaskTest::SetUp() { DeviceConditions conditions; - store_.reset(new RequestQueueInMemoryStore()); policy_.reset(new OfflinerPolicy()); notifier_.reset(new RequestNotifierStub()); MakeFactoryAndTask(); - store_->Initialize(base::BindOnce(&CleanupTaskTest::InitializeStoreDone, - base::Unretained(this))); - PumpLoop(); -} - -void CleanupTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); + InitializeStore(); } void CleanupTaskTest::AddRequestDone(ItemActionStatus status) { @@ -164,10 +142,10 @@ DeviceConditions conditions; std::set<int64_t> disabled_requests; // Add test requests on the Queue. - store_->AddRequest(request1, base::BindOnce(&CleanupTaskTest::AddRequestDone, - base::Unretained(this))); - store_->AddRequest(request2, base::BindOnce(&CleanupTaskTest::AddRequestDone, - base::Unretained(this))); + store_.AddRequest(request1, base::BindOnce(&CleanupTaskTest::AddRequestDone, + base::Unretained(this))); + store_.AddRequest(request2, base::BindOnce(&CleanupTaskTest::AddRequestDone, + base::Unretained(this))); // Pump the loop to give the async queue the opportunity to do the adds. PumpLoop(); @@ -177,11 +155,7 @@ factory_.reset( new CleanupTaskFactory(policy_.get(), notifier_.get(), &event_logger_)); DeviceConditions conditions; - task_ = factory_->CreateCleanupTask(store_.get()); -} - -void CleanupTaskTest::InitializeStoreDone(bool success) { - ASSERT_TRUE(success); + task_ = factory_->CreateCleanupTask(&store_); } TEST_F(CleanupTaskTest, CleanupExpiredRequest) { @@ -279,4 +253,5 @@ EXPECT_EQ(kRequestId1, found_requests().at(0)->request_id()); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/get_requests_task_unittest.cc b/components/offline_pages/core/background/get_requests_task_unittest.cc index 082cb9036..0f78a3d2 100644 --- a/components/offline_pages/core/background/get_requests_task_unittest.cc +++ b/components/offline_pages/core/background/get_requests_task_unittest.cc
@@ -7,9 +7,11 @@ #include <memory> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -20,16 +22,12 @@ const GURL kUrl2("http://otherexample.com"); const ClientId kClientId1("download", "1234"); const ClientId kClientId2("download", "5678"); -} // namespace -class GetRequestsTaskTest : public testing::Test { +class GetRequestsTaskTest : public RequestQueueTaskTestBase { public: - GetRequestsTaskTest(); - ~GetRequestsTaskTest() override; + GetRequestsTaskTest() = default; + ~GetRequestsTaskTest() override = default; - void PumpLoop(); - - void InitializeStore(RequestQueueStore* store); void AddItemsToStore(RequestQueueStore* store); void GetRequestsCallback( bool success, @@ -44,34 +42,13 @@ } private: - void InitializeStoreDone(bool success); void AddRequestDone(ItemActionStatus status); - bool callback_called_; - bool success_; + bool callback_called_ = false; + bool success_ = false; std::vector<std::unique_ptr<SavePageRequest>> requests_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; -GetRequestsTaskTest::GetRequestsTaskTest() - : callback_called_(false), - success_(false), - task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -GetRequestsTaskTest::~GetRequestsTaskTest() {} - -void GetRequestsTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); -} - -void GetRequestsTaskTest::InitializeStore(RequestQueueStore* store) { - store->Initialize(base::BindOnce(&GetRequestsTaskTest::InitializeStoreDone, - base::Unretained(this))); - PumpLoop(); -} - void GetRequestsTaskTest::AddItemsToStore(RequestQueueStore* store) { base::Time creation_time = base::Time::Now(); SavePageRequest request_1(kRequestId1, kUrl1, kClientId1, creation_time, @@ -96,18 +73,13 @@ requests_ = std::move(requests); } -void GetRequestsTaskTest::InitializeStoreDone(bool success) { - ASSERT_TRUE(success); -} - void GetRequestsTaskTest::AddRequestDone(ItemActionStatus status) { ASSERT_EQ(ItemActionStatus::SUCCESS, status); } TEST_F(GetRequestsTaskTest, GetFromEmptyStore) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - GetRequestsTask task(&store, + InitializeStore(); + GetRequestsTask task(&store_, base::BindOnce(&GetRequestsTaskTest::GetRequestsCallback, base::Unretained(this))); task.Run(); @@ -118,11 +90,10 @@ } TEST_F(GetRequestsTaskTest, GetMultipleRequests) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddItemsToStore(&store); + InitializeStore(); + AddItemsToStore(&store_); - GetRequestsTask task(&store, + GetRequestsTask task(&store_, base::BindOnce(&GetRequestsTaskTest::GetRequestsCallback, base::Unretained(this))); task.Run(); @@ -137,4 +108,5 @@ EXPECT_EQ(kRequestId2, last_requests().at(id_2_index)->request_id()); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/initialize_store_task_unittest.cc b/components/offline_pages/core/background/initialize_store_task_unittest.cc index 8e14188..289637d7 100644 --- a/components/offline_pages/core/background/initialize_store_task_unittest.cc +++ b/components/offline_pages/core/background/initialize_store_task_unittest.cc
@@ -7,24 +7,25 @@ #include <memory> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { +namespace { -using TestScenario = RequestQueueInMemoryStore::TestScenario; - -class InitializeStoreTaskTest : public testing::Test { +class InitializeStoreTaskTest : public RequestQueueTaskTestBase { public: - InitializeStoreTaskTest(); - ~InitializeStoreTaskTest() override; + InitializeStoreTaskTest() : callback_called_(false), success_(false) {} + ~InitializeStoreTaskTest() override {} - void PumpLoop(); - void RunNextStep(); - - void InitializeCallback(bool success); + void InitializeCallback(bool success) { + callback_called_ = true; + success_ = success; + } bool callback_called() const { return callback_called_; } @@ -33,75 +34,49 @@ private: bool callback_called_; bool success_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; -InitializeStoreTaskTest::InitializeStoreTaskTest() - : callback_called_(false), - success_(false), - task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -InitializeStoreTaskTest::~InitializeStoreTaskTest() {} - -void InitializeStoreTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); -} - -void InitializeStoreTaskTest::RunNextStep() { - // Only runs tasks that are already scheduled and available. If running these - // tasks post new tasks to the runner, they will not be triggered. This allows - // for running InitializeStoreTask one step at a time. - task_runner_->RunPendingTasks(); -} - -void InitializeStoreTaskTest::InitializeCallback(bool success) { - callback_called_ = true; - success_ = success; -} TEST_F(InitializeStoreTaskTest, SuccessfulInitialization) { - RequestQueueInMemoryStore store; InitializeStoreTask task( - &store, base::BindOnce(&InitializeStoreTaskTest::InitializeCallback, - base::Unretained(this))); + &store_, base::BindOnce(&InitializeStoreTaskTest::InitializeCallback, + base::Unretained(this))); task.Run(); PumpLoop(); EXPECT_TRUE(callback_called()); EXPECT_TRUE(last_call_successful()); - EXPECT_EQ(StoreState::LOADED, store.state()); + EXPECT_EQ(StoreState::LOADED, store_.state()); } TEST_F(InitializeStoreTaskTest, SuccessfulReset) { - RequestQueueInMemoryStore store(TestScenario::LOAD_FAILED_RESET_SUCCESS); + store_.set_force_initialize_fail(); + store_.set_resume_after_reset(); InitializeStoreTask task( - &store, base::BindOnce(&InitializeStoreTaskTest::InitializeCallback, - base::Unretained(this))); + &store_, base::BindOnce(&InitializeStoreTaskTest::InitializeCallback, + base::Unretained(this))); task.Run(); - EXPECT_FALSE(callback_called()); - EXPECT_EQ(StoreState::FAILED_LOADING, store.state()); - - RunNextStep(); - EXPECT_FALSE(callback_called()); - EXPECT_EQ(StoreState::NOT_LOADED, store.state()); PumpLoop(); + + // Reset should have cleared this value. + EXPECT_TRUE(!store_.force_initialize_fail()); EXPECT_TRUE(callback_called()); EXPECT_TRUE(last_call_successful()); - EXPECT_EQ(StoreState::LOADED, store.state()); + + EXPECT_EQ(StoreState::LOADED, store_.state()); } TEST_F(InitializeStoreTaskTest, FailedReset) { - RequestQueueInMemoryStore store(TestScenario::LOAD_FAILED_RESET_FAILED); + store_.set_force_initialize_fail(); InitializeStoreTask task( - &store, base::BindOnce(&InitializeStoreTaskTest::InitializeCallback, - base::Unretained(this))); + &store_, base::BindOnce(&InitializeStoreTaskTest::InitializeCallback, + base::Unretained(this))); task.Run(); PumpLoop(); EXPECT_TRUE(callback_called()); EXPECT_FALSE(last_call_successful()); - EXPECT_EQ(StoreState::FAILED_RESET, store.state()); + EXPECT_EQ(StoreState::FAILED_RESET, store_.state()); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/mark_attempt_aborted_task_unittest.cc b/components/offline_pages/core/background/mark_attempt_aborted_task_unittest.cc index 58f017bd..5271bb5 100644 --- a/components/offline_pages/core/background/mark_attempt_aborted_task_unittest.cc +++ b/components/offline_pages/core/background/mark_attempt_aborted_task_unittest.cc
@@ -7,11 +7,14 @@ #include <memory> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "components/offline_pages/core/background/change_requests_state_task.h" #include "components/offline_pages/core/background/mark_attempt_started_task.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" + #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -20,16 +23,12 @@ const int64_t kRequestId2 = 44; const GURL kUrl1("http://example.com"); const ClientId kClientId1("download", "1234"); -} // namespace -class MarkAttemptAbortedTaskTest : public testing::Test { +class MarkAttemptAbortedTaskTest : public RequestQueueTaskTestBase { public: - MarkAttemptAbortedTaskTest(); - ~MarkAttemptAbortedTaskTest() override; + MarkAttemptAbortedTaskTest() {} + ~MarkAttemptAbortedTaskTest() override {} - void PumpLoop(); - - void InitializeStore(RequestQueueStore* store); void AddItemToStore(RequestQueueStore* store); void ChangeRequestsStateCallback( std::unique_ptr<UpdateRequestsResult> result); @@ -38,32 +37,13 @@ UpdateRequestsResult* last_result() const { return result_.get(); } - private: + protected: void InitializeStoreDone(bool success); void AddRequestDone(ItemActionStatus status); std::unique_ptr<UpdateRequestsResult> result_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; -MarkAttemptAbortedTaskTest::MarkAttemptAbortedTaskTest() - : task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -MarkAttemptAbortedTaskTest::~MarkAttemptAbortedTaskTest() {} - -void MarkAttemptAbortedTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); -} - -void MarkAttemptAbortedTaskTest::InitializeStore(RequestQueueStore* store) { - store->Initialize( - base::BindOnce(&MarkAttemptAbortedTaskTest::InitializeStoreDone, - base::Unretained(this))); - PumpLoop(); -} - void MarkAttemptAbortedTaskTest::AddItemToStore(RequestQueueStore* store) { base::Time creation_time = base::Time::Now(); SavePageRequest request_1(kRequestId1, kUrl1, kClientId1, creation_time, @@ -92,11 +72,10 @@ } TEST_F(MarkAttemptAbortedTaskTest, MarkAttemptAbortedWhenStoreEmpty) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(); MarkAttemptAbortedTask task( - &store, kRequestId1, + &store_, kRequestId1, base::BindOnce(&MarkAttemptAbortedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -110,13 +89,12 @@ } TEST_F(MarkAttemptAbortedTaskTest, MarkAttemptAbortedWhenExists) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddItemToStore(&store); + InitializeStore(); + AddItemToStore(&store_); // First mark attempt started. MarkAttemptStartedTask start_request_task( - &store, kRequestId1, + &store_, kRequestId1, base::BindOnce(&MarkAttemptAbortedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); start_request_task.Run(); @@ -124,7 +102,7 @@ ClearResults(); MarkAttemptAbortedTask task( - &store, kRequestId1, + &store_, kRequestId1, base::BindOnce(&MarkAttemptAbortedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); @@ -141,12 +119,11 @@ } TEST_F(MarkAttemptAbortedTaskTest, MarkAttemptAbortedWhenItemMissing) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddItemToStore(&store); + InitializeStore(); + AddItemToStore(&store_); MarkAttemptAbortedTask task( - &store, kRequestId2, + &store_, kRequestId2, base::BindOnce(&MarkAttemptAbortedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -160,13 +137,12 @@ } TEST_F(MarkAttemptAbortedTaskTest, MarkAttemptAbortedWhenPaused) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddItemToStore(&store); + InitializeStore(); + AddItemToStore(&store_); // First mark attempt started. MarkAttemptStartedTask start_request_task( - &store, kRequestId1, + &store_, kRequestId1, base::BindOnce(&MarkAttemptAbortedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); start_request_task.Run(); @@ -177,7 +153,7 @@ std::vector<int64_t> requests; requests.push_back(kRequestId1); ChangeRequestsStateTask pauseTask( - &store, requests, SavePageRequest::RequestState::PAUSED, + &store_, requests, SavePageRequest::RequestState::PAUSED, base::BindOnce(&MarkAttemptAbortedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); pauseTask.Run(); @@ -185,7 +161,7 @@ // Abort the task, the state should not change from PAUSED. MarkAttemptAbortedTask abortTask( - &store, kRequestId1, + &store_, kRequestId1, base::BindOnce(&MarkAttemptAbortedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); @@ -201,4 +177,5 @@ last_result()->updated_items.at(0).request_state()); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/mark_attempt_completed_task_unittest.cc b/components/offline_pages/core/background/mark_attempt_completed_task_unittest.cc index 441a178..e93a91d7 100644 --- a/components/offline_pages/core/background/mark_attempt_completed_task_unittest.cc +++ b/components/offline_pages/core/background/mark_attempt_completed_task_unittest.cc
@@ -8,9 +8,9 @@ #include <utility> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" -#include "base/threading/thread_task_runner_handle.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -19,55 +19,30 @@ const int64_t kRequestId2 = 44; const GURL kUrl1("http://example.com"); const ClientId kClientId1("download", "1234"); -} // namespace -class MarkAttemptCompletedTaskTest : public testing::Test { +class MarkAttemptCompletedTaskTest : public RequestQueueTaskTestBase { public: - MarkAttemptCompletedTaskTest(); - ~MarkAttemptCompletedTaskTest() override; + MarkAttemptCompletedTaskTest() {} + ~MarkAttemptCompletedTaskTest() override {} - void PumpLoop(); - - void InitializeStore(RequestQueueStore* store); - void AddStartedItemToStore(RequestQueueStore* store); + void AddStartedItemToStore(); void ChangeRequestsStateCallback( std::unique_ptr<UpdateRequestsResult> result); UpdateRequestsResult* last_result() const { return result_.get(); } private: - void InitializeStoreDone(bool success); void AddRequestDone(ItemActionStatus status); std::unique_ptr<UpdateRequestsResult> result_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; -MarkAttemptCompletedTaskTest::MarkAttemptCompletedTaskTest() - : task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -MarkAttemptCompletedTaskTest::~MarkAttemptCompletedTaskTest() {} - -void MarkAttemptCompletedTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); -} - -void MarkAttemptCompletedTaskTest::InitializeStore(RequestQueueStore* store) { - store->Initialize( - base::BindOnce(&MarkAttemptCompletedTaskTest::InitializeStoreDone, - base::Unretained(this))); - PumpLoop(); -} - -void MarkAttemptCompletedTaskTest::AddStartedItemToStore( - RequestQueueStore* store) { +void MarkAttemptCompletedTaskTest::AddStartedItemToStore() { base::Time creation_time = base::Time::Now(); SavePageRequest request_1(kRequestId1, kUrl1, kClientId1, creation_time, true); request_1.MarkAttemptStarted(base::Time::Now()); - store->AddRequest( + store_.AddRequest( request_1, base::BindOnce(&MarkAttemptCompletedTaskTest::AddRequestDone, base::Unretained(this))); PumpLoop(); @@ -78,21 +53,16 @@ result_ = std::move(result); } -void MarkAttemptCompletedTaskTest::InitializeStoreDone(bool success) { - ASSERT_TRUE(success); -} - void MarkAttemptCompletedTaskTest::AddRequestDone(ItemActionStatus status) { ASSERT_EQ(ItemActionStatus::SUCCESS, status); } TEST_F(MarkAttemptCompletedTaskTest, MarkAttemptCompletedWhenExists) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddStartedItemToStore(&store); + InitializeStore(); + AddStartedItemToStore(); MarkAttemptCompletedTask task( - &store, kRequestId1, FailState::CANNOT_DOWNLOAD, + &store_, kRequestId1, FailState::CANNOT_DOWNLOAD, base::BindOnce(&MarkAttemptCompletedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); @@ -110,13 +80,12 @@ } TEST_F(MarkAttemptCompletedTaskTest, MarkAttemptCompletedWhenItemMissing) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(); // Add request 1 to the store. - AddStartedItemToStore(&store); + AddStartedItemToStore(); // Try to mark request 2 (not in the store). MarkAttemptCompletedTask task( - &store, kRequestId2, FailState::CANNOT_DOWNLOAD, + &store_, kRequestId2, FailState::CANNOT_DOWNLOAD, base::BindOnce(&MarkAttemptCompletedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -129,4 +98,5 @@ EXPECT_EQ(0UL, last_result()->updated_items.size()); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/mark_attempt_started_task_unittest.cc b/components/offline_pages/core/background/mark_attempt_started_task_unittest.cc index 902fe50..9e18ed17 100644 --- a/components/offline_pages/core/background/mark_attempt_started_task_unittest.cc +++ b/components/offline_pages/core/background/mark_attempt_started_task_unittest.cc
@@ -7,9 +7,11 @@ #include <memory> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -18,53 +20,29 @@ const int64_t kRequestId2 = 44; const GURL kUrl1("http://example.com"); const ClientId kClientId1("download", "1234"); -} // namespace -class MarkAttemptStartedTaskTest : public testing::Test { +class MarkAttemptStartedTaskTest : public RequestQueueTaskTestBase { public: - MarkAttemptStartedTaskTest(); - ~MarkAttemptStartedTaskTest() override; + MarkAttemptStartedTaskTest() {} + ~MarkAttemptStartedTaskTest() override {} - void PumpLoop(); - - void InitializeStore(RequestQueueStore* store); - void AddItemToStore(RequestQueueStore* store); + void AddItemToStore(); void ChangeRequestsStateCallback( std::unique_ptr<UpdateRequestsResult> result); UpdateRequestsResult* last_result() const { return result_.get(); } private: - void InitializeStoreDone(bool success); void AddRequestDone(ItemActionStatus status); std::unique_ptr<UpdateRequestsResult> result_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; -MarkAttemptStartedTaskTest::MarkAttemptStartedTaskTest() - : task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -MarkAttemptStartedTaskTest::~MarkAttemptStartedTaskTest() {} - -void MarkAttemptStartedTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); -} - -void MarkAttemptStartedTaskTest::InitializeStore(RequestQueueStore* store) { - store->Initialize( - base::BindOnce(&MarkAttemptStartedTaskTest::InitializeStoreDone, - base::Unretained(this))); - PumpLoop(); -} - -void MarkAttemptStartedTaskTest::AddItemToStore(RequestQueueStore* store) { +void MarkAttemptStartedTaskTest::AddItemToStore() { base::Time creation_time = base::Time::Now(); SavePageRequest request_1(kRequestId1, kUrl1, kClientId1, creation_time, true); - store->AddRequest(request_1, + store_.AddRequest(request_1, base::BindOnce(&MarkAttemptStartedTaskTest::AddRequestDone, base::Unretained(this))); PumpLoop(); @@ -75,20 +53,15 @@ result_ = std::move(result); } -void MarkAttemptStartedTaskTest::InitializeStoreDone(bool success) { - ASSERT_TRUE(success); -} - void MarkAttemptStartedTaskTest::AddRequestDone(ItemActionStatus status) { ASSERT_EQ(ItemActionStatus::SUCCESS, status); } TEST_F(MarkAttemptStartedTaskTest, MarkAttemptStartedWhenStoreEmpty) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(); MarkAttemptStartedTask task( - &store, kRequestId1, + &store_, kRequestId1, base::BindOnce(&MarkAttemptStartedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -102,12 +75,11 @@ } TEST_F(MarkAttemptStartedTaskTest, MarkAttemptStartedWhenExists) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddItemToStore(&store); + InitializeStore(); + AddItemToStore(); MarkAttemptStartedTask task( - &store, kRequestId1, + &store_, kRequestId1, base::BindOnce(&MarkAttemptStartedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); @@ -131,12 +103,11 @@ } TEST_F(MarkAttemptStartedTaskTest, MarkAttemptStartedWhenItemMissing) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddItemToStore(&store); + InitializeStore(); + AddItemToStore(); MarkAttemptStartedTask task( - &store, kRequestId2, + &store_, kRequestId2, base::BindOnce(&MarkAttemptStartedTaskTest::ChangeRequestsStateCallback, base::Unretained(this))); task.Run(); @@ -149,4 +120,5 @@ EXPECT_EQ(0UL, last_result()->updated_items.size()); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/pick_request_task_unittest.cc b/components/offline_pages/core/background/pick_request_task_unittest.cc index a84c275..8b487f3c 100644 --- a/components/offline_pages/core/background/pick_request_task_unittest.cc +++ b/components/offline_pages/core/background/pick_request_task_unittest.cc
@@ -9,7 +9,7 @@ #include "base/bind.h" #include "base/containers/circular_deque.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "components/offline_pages/core/background/device_conditions.h" @@ -17,9 +17,10 @@ #include "components/offline_pages/core/background/request_coordinator.h" #include "components/offline_pages/core/background/request_coordinator_event_logger.h" #include "components/offline_pages/core/background/request_notifier.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" #include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" #include "components/offline_pages/core/background/save_page_request.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -50,7 +51,6 @@ ClientId("", ""), base::Time(), true); -} // namespace // Helper class needed by the PickRequestTask class RequestNotifierStub : public RequestNotifier { @@ -88,16 +88,13 @@ int32_t total_expired_requests_; }; -class PickRequestTaskTest : public testing::Test { +class PickRequestTaskTest : public RequestQueueTaskTestBase { public: - PickRequestTaskTest(); - - ~PickRequestTaskTest() override; + PickRequestTaskTest() {} + ~PickRequestTaskTest() override {} void SetUp() override; - void PumpLoop(); - void AddRequestDone(ItemActionStatus status); void RequestPicked( @@ -123,9 +120,7 @@ void TaskCompletionCallback(Task* completed_task); protected: - void InitializeStoreDone(bool success); - std::unique_ptr<RequestQueueStore> store_; std::unique_ptr<RequestNotifierStub> notifier_; std::unique_ptr<SavePageRequest> last_picked_; std::unique_ptr<OfflinerPolicy> policy_; @@ -138,21 +133,10 @@ size_t total_request_count_; size_t available_request_count_; bool task_complete_called_; - - private: - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; -PickRequestTaskTest::PickRequestTaskTest() - : task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -PickRequestTaskTest::~PickRequestTaskTest() {} - void PickRequestTaskTest::SetUp() { DeviceConditions conditions; - store_.reset(new RequestQueueInMemoryStore()); policy_.reset(new OfflinerPolicy()); notifier_.reset(new RequestNotifierStub()); MakePickRequestTask(); @@ -163,15 +147,10 @@ last_picked_.reset(); cleanup_needed_ = false; - store_->Initialize(base::BindOnce(&PickRequestTaskTest::InitializeStoreDone, - base::Unretained(this))); + InitializeStore(); PumpLoop(); } -void PickRequestTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); -} - void PickRequestTaskTest::TaskCompletionCallback(Task* completed_task) { task_complete_called_ = true; } @@ -204,12 +183,12 @@ DeviceConditions conditions; std::set<int64_t> disabled_requests; // Add test requests on the Queue. - store_->AddRequest(request1, - base::BindOnce(&PickRequestTaskTest::AddRequestDone, - base::Unretained(this))); - store_->AddRequest(request2, - base::BindOnce(&PickRequestTaskTest::AddRequestDone, - base::Unretained(this))); + store_.AddRequest(request1, + base::BindOnce(&PickRequestTaskTest::AddRequestDone, + base::Unretained(this))); + store_.AddRequest(request2, + base::BindOnce(&PickRequestTaskTest::AddRequestDone, + base::Unretained(this))); // Pump the loop to give the async queue the opportunity to do the adds. PumpLoop(); @@ -218,7 +197,7 @@ void PickRequestTaskTest::MakePickRequestTask() { DeviceConditions conditions; task_.reset(new PickRequestTask( - store_.get(), policy_.get(), + &store_, policy_.get(), base::BindOnce(&PickRequestTaskTest::RequestPicked, base::Unretained(this)), base::BindOnce(&PickRequestTaskTest::RequestNotPicked, @@ -232,10 +211,6 @@ base::Unretained(this))); } -void PickRequestTaskTest::InitializeStoreDone(bool success) { - ASSERT_TRUE(success); -} - TEST_F(PickRequestTaskTest, PickFromEmptyQueue) { task()->Run(); PumpLoop(); @@ -573,4 +548,6 @@ EXPECT_TRUE(task_complete_called_); EXPECT_EQ(2UL, prioritized_requests_.size()); } + +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/reconcile_task_unittest.cc b/components/offline_pages/core/background/reconcile_task_unittest.cc index e1e918539..6f12ee8c 100644 --- a/components/offline_pages/core/background/reconcile_task_unittest.cc +++ b/components/offline_pages/core/background/reconcile_task_unittest.cc
@@ -8,12 +8,13 @@ #include <set> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "components/offline_pages/core/background/request_coordinator.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" #include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" #include "components/offline_pages/core/background/save_page_request.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -35,18 +36,14 @@ ClientId("", ""), base::Time(), true); -} // namespace -class ReconcileTaskTest : public testing::Test { +class ReconcileTaskTest : public RequestQueueTaskTestBase { public: - ReconcileTaskTest(); - - ~ReconcileTaskTest() override; + ReconcileTaskTest() {} + ~ReconcileTaskTest() override {} void SetUp() override; - void PumpLoop(); - void AddRequestDone(ItemActionStatus status); void GetRequestsCallback( @@ -62,43 +59,22 @@ void MakeTask(); ReconcileTask* task() { return task_.get(); } - RequestQueueStore* store() { return store_.get(); } std::vector<std::unique_ptr<SavePageRequest>>& found_requests() { return found_requests_; } protected: - void InitializeStoreDone(bool success); - std::unique_ptr<RequestQueueStore> store_; std::unique_ptr<ReconcileTask> task_; std::vector<std::unique_ptr<SavePageRequest>> found_requests_; - bool reconcile_called_; - - private: - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; + bool reconcile_called_ = false; }; -ReconcileTaskTest::ReconcileTaskTest() - : reconcile_called_(false), - task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -ReconcileTaskTest::~ReconcileTaskTest() {} - void ReconcileTaskTest::SetUp() { DeviceConditions conditions; - store_.reset(new RequestQueueInMemoryStore()); MakeTask(); - store_->Initialize(base::BindOnce(&ReconcileTaskTest::InitializeStoreDone, - base::Unretained(this))); - PumpLoop(); -} - -void ReconcileTaskTest::PumpLoop() { - task_runner_->RunUntilIdle(); + InitializeStore(); } void ReconcileTaskTest::AddRequestDone(ItemActionStatus status) { @@ -125,12 +101,10 @@ DeviceConditions conditions; std::set<int64_t> disabled_requests; // Add test requests on the Queue. - store_->AddRequest(request1, - base::BindOnce(&ReconcileTaskTest::AddRequestDone, - base::Unretained(this))); - store_->AddRequest(request2, - base::BindOnce(&ReconcileTaskTest::AddRequestDone, - base::Unretained(this))); + store_.AddRequest(request1, base::BindOnce(&ReconcileTaskTest::AddRequestDone, + base::Unretained(this))); + store_.AddRequest(request2, base::BindOnce(&ReconcileTaskTest::AddRequestDone, + base::Unretained(this))); // Pump the loop to give the async queue the opportunity to do the adds. PumpLoop(); @@ -138,12 +112,8 @@ void ReconcileTaskTest::MakeTask() { task_.reset(new ReconcileTask( - store_.get(), base::BindOnce(&ReconcileTaskTest::ReconcileCallback, - base::Unretained(this)))); -} - -void ReconcileTaskTest::InitializeStoreDone(bool success) { - ASSERT_TRUE(success); + &store_, base::BindOnce(&ReconcileTaskTest::ReconcileCallback, + base::Unretained(this)))); } TEST_F(ReconcileTaskTest, Reconcile) { @@ -162,8 +132,8 @@ PumpLoop(); // See what is left in the queue, should be just the other request. - store()->GetRequests(base::BindOnce(&ReconcileTaskTest::GetRequestsCallback, - base::Unretained(this))); + store_.GetRequests(base::BindOnce(&ReconcileTaskTest::GetRequestsCallback, + base::Unretained(this))); PumpLoop(); EXPECT_EQ(2UL, found_requests().size()); @@ -197,8 +167,8 @@ PumpLoop(); // See what is left in the queue, should be just the other request. - store()->GetRequests(base::BindOnce(&ReconcileTaskTest::GetRequestsCallback, - base::Unretained(this))); + store_.GetRequests(base::BindOnce(&ReconcileTaskTest::GetRequestsCallback, + base::Unretained(this))); PumpLoop(); EXPECT_EQ(2UL, found_requests().size()); @@ -218,4 +188,5 @@ EXPECT_FALSE(reconcile_called_); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/remove_requests_task_unittest.cc b/components/offline_pages/core/background/remove_requests_task_unittest.cc index d66fac1..4b4b1738 100644 --- a/components/offline_pages/core/background/remove_requests_task_unittest.cc +++ b/components/offline_pages/core/background/remove_requests_task_unittest.cc
@@ -7,9 +7,11 @@ #include <memory> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" +#include "components/offline_pages/core/background/request_queue_task_test_base.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -21,56 +23,39 @@ const GURL kUrl2("http://another-example.com"); const ClientId kClientId1("bookmark", "1234"); const ClientId kClientId2("async", "5678"); -} // namespace -class RemoveRequestsTaskTest : public testing::Test { +class RemoveRequestsTaskTest : public RequestQueueTaskTestBase { public: - RemoveRequestsTaskTest(); - ~RemoveRequestsTaskTest() override; + RemoveRequestsTaskTest() {} + ~RemoveRequestsTaskTest() override {} void PumpLoop(); - void InitializeStore(RequestQueueStore* store); - void AddRequestsToStore(RequestQueueStore* store); + void AddRequestsToStore(); void RemoveRequestsCallback(std::unique_ptr<UpdateRequestsResult> result); UpdateRequestsResult* last_result() const { return result_.get(); } private: - void InitializeStoreDone(bool succesS); void AddRequestDone(ItemActionStatus status); std::unique_ptr<UpdateRequestsResult> result_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - base::ThreadTaskRunnerHandle task_runner_handle_; }; -RemoveRequestsTaskTest::RemoveRequestsTaskTest() - : task_runner_(new base::TestSimpleTaskRunner), - task_runner_handle_(task_runner_) {} - -RemoveRequestsTaskTest::~RemoveRequestsTaskTest() {} - void RemoveRequestsTaskTest::PumpLoop() { task_runner_->RunUntilIdle(); } -void RemoveRequestsTaskTest::InitializeStore(RequestQueueStore* store) { - store->Initialize(base::BindOnce(&RemoveRequestsTaskTest::InitializeStoreDone, - base::Unretained(this))); - PumpLoop(); -} - -void RemoveRequestsTaskTest::AddRequestsToStore(RequestQueueStore* store) { +void RemoveRequestsTaskTest::AddRequestsToStore() { base::Time creation_time = base::Time::Now(); SavePageRequest request_1(kRequestId1, kUrl1, kClientId1, creation_time, true); - store->AddRequest(request_1, + store_.AddRequest(request_1, base::BindOnce(&RemoveRequestsTaskTest::AddRequestDone, base::Unretained(this))); SavePageRequest request_2(kRequestId2, kUrl2, kClientId2, creation_time, true); - store->AddRequest(request_2, + store_.AddRequest(request_2, base::BindOnce(&RemoveRequestsTaskTest::AddRequestDone, base::Unretained(this))); PumpLoop(); @@ -81,21 +66,16 @@ result_ = std::move(result); } -void RemoveRequestsTaskTest::InitializeStoreDone(bool success) { - ASSERT_TRUE(success); -} - void RemoveRequestsTaskTest::AddRequestDone(ItemActionStatus status) { ASSERT_EQ(ItemActionStatus::SUCCESS, status); } TEST_F(RemoveRequestsTaskTest, RemoveWhenStoreEmpty) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(); std::vector<int64_t> request_ids{kRequestId1}; RemoveRequestsTask task( - &store, request_ids, + &store_, request_ids, base::BindOnce(&RemoveRequestsTaskTest::RemoveRequestsCallback, base::Unretained(this))); task.Run(); @@ -109,13 +89,12 @@ } TEST_F(RemoveRequestsTaskTest, RemoveSingleItem) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddRequestsToStore(&store); + InitializeStore(); + AddRequestsToStore(); std::vector<int64_t> request_ids{kRequestId1}; RemoveRequestsTask task( - &store, request_ids, + &store_, request_ids, base::BindOnce(&RemoveRequestsTaskTest::RemoveRequestsCallback, base::Unretained(this))); task.Run(); @@ -130,13 +109,12 @@ } TEST_F(RemoveRequestsTaskTest, RemoveMultipleItems) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddRequestsToStore(&store); + InitializeStore(); + AddRequestsToStore(); std::vector<int64_t> request_ids{kRequestId1, kRequestId2}; RemoveRequestsTask task( - &store, request_ids, + &store_, request_ids, base::BindOnce(&RemoveRequestsTaskTest::RemoveRequestsCallback, base::Unretained(this))); task.Run(); @@ -155,12 +133,11 @@ } TEST_F(RemoveRequestsTaskTest, DeleteWithEmptyIdList) { - RequestQueueInMemoryStore store; - InitializeStore(&store); + InitializeStore(); std::vector<int64_t> request_ids; RemoveRequestsTask task( - &store, request_ids, + &store_, request_ids, base::BindOnce(&RemoveRequestsTaskTest::RemoveRequestsCallback, base::Unretained(this))); task.Run(); @@ -171,13 +148,12 @@ } TEST_F(RemoveRequestsTaskTest, RemoveMissingItem) { - RequestQueueInMemoryStore store; - InitializeStore(&store); - AddRequestsToStore(&store); + InitializeStore(); + AddRequestsToStore(); std::vector<int64_t> request_ids{kRequestId1, kRequestId3}; RemoveRequestsTask task( - &store, request_ids, + &store_, request_ids, base::BindOnce(&RemoveRequestsTaskTest::RemoveRequestsCallback, base::Unretained(this))); task.Run(); @@ -194,4 +170,5 @@ EXPECT_EQ(kRequestId1, last_result()->updated_items.at(0).request_id()); } +} // namespace } // namespace offline_pages
diff --git a/components/offline_pages/core/background/request_coordinator_stub_taco.cc b/components/offline_pages/core/background/request_coordinator_stub_taco.cc index c468d4a..ddda5ed 100644 --- a/components/offline_pages/core/background/request_coordinator_stub_taco.cc +++ b/components/offline_pages/core/background/request_coordinator_stub_taco.cc
@@ -6,10 +6,11 @@ #include "components/offline_pages/core/background/offliner_stub.h" #include "components/offline_pages/core/background/request_queue.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" #include "components/offline_pages/core/background/save_page_request.h" #include "components/offline_pages/core/background/scheduler.h" #include "components/offline_pages/core/background/scheduler_stub.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "components/offline_pages/core/offline_pages_ukm_reporter_stub.h" #include "services/network/test/test_network_quality_tracker.h" @@ -17,8 +18,8 @@ RequestCoordinatorStubTaco::RequestCoordinatorStubTaco() { policy_ = std::make_unique<OfflinerPolicy>(); - queue_ = std::make_unique<RequestQueue>( - std::make_unique<RequestQueueInMemoryStore>()); + queue_ = + std::make_unique<RequestQueue>(std::make_unique<TestRequestQueueStore>()); offliner_ = std::make_unique<OfflinerStub>(); scheduler_ = std::make_unique<SchedulerStub>(); network_quality_tracker_ =
diff --git a/components/offline_pages/core/background/request_coordinator_unittest.cc b/components/offline_pages/core/background/request_coordinator_unittest.cc index 0002b5e..f0d21cbc 100644 --- a/components/offline_pages/core/background/request_coordinator_unittest.cc +++ b/components/offline_pages/core/background/request_coordinator_unittest.cc
@@ -27,7 +27,7 @@ #include "components/offline_pages/core/background/offliner_stub.h" #include "components/offline_pages/core/background/request_coordinator_stub_taco.h" #include "components/offline_pages/core/background/request_queue.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" #include "components/offline_pages/core/background/save_page_request.h" #include "components/offline_pages/core/background/scheduler.h" #include "components/offline_pages/core/background/scheduler_stub.h" @@ -55,7 +55,6 @@ const bool kUserRequested = true; const int kAttemptCount = 1; const std::string kRequestOrigin("abc.xyz"); -} // namespace class ObserverStub : public RequestCoordinator::Observer { public: @@ -125,6 +124,10 @@ PendingState pending_state_; }; +} // namespace + +// This class is a friend of RequestCoordinator, and can't be in the anonymous +// namespace. class RequestCoordinatorTest : public testing::Test { public: using RequestCoordinatorState = RequestCoordinator::RequestCoordinatorState; @@ -133,7 +136,12 @@ ~RequestCoordinatorTest() override; void SetUp() override; - + void TearDown() override { + PumpLoop(); + coordinator_taco_.reset(); + // Ensure cleanup tasks are complete, or we may leak memory. + task_runner_->FastForwardUntilNoTasksRemain(); + } void PumpLoop(); RequestCoordinator* coordinator() const {
diff --git a/components/offline_pages/core/background/request_queue_in_memory_store.cc b/components/offline_pages/core/background/request_queue_in_memory_store.cc deleted file mode 100644 index b37209d..0000000 --- a/components/offline_pages/core/background/request_queue_in_memory_store.cc +++ /dev/null
@@ -1,160 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" - -#include <unordered_set> -#include <utility> - -#include "base/bind.h" -#include "base/location.h" -#include "base/threading/thread_task_runner_handle.h" -#include "components/offline_pages/core/background/save_page_request.h" - -namespace offline_pages { - -RequestQueueInMemoryStore::RequestQueueInMemoryStore() - : state_(StoreState::NOT_LOADED), scenario_(TestScenario::SUCCESSFUL) {} - -RequestQueueInMemoryStore::RequestQueueInMemoryStore(TestScenario scenario) - : state_(StoreState::NOT_LOADED), scenario_(scenario) {} - -RequestQueueInMemoryStore::~RequestQueueInMemoryStore() {} - -void RequestQueueInMemoryStore::Initialize(InitializeCallback callback) { - if (scenario_ == TestScenario::SUCCESSFUL) - state_ = StoreState::LOADED; - else - state_ = StoreState::FAILED_LOADING; - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(callback), state_ == StoreState::LOADED)); -} - -void RequestQueueInMemoryStore::GetRequests(GetRequestsCallback callback) { - DCHECK_NE(state_, StoreState::NOT_LOADED); - std::vector<std::unique_ptr<SavePageRequest>> result_requests; - for (const auto& id_request_pair : requests_) { - std::unique_ptr<SavePageRequest> request( - new SavePageRequest(id_request_pair.second)); - result_requests.push_back(std::move(request)); - } - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(callback), true, std::move(result_requests))); -} - -void RequestQueueInMemoryStore::GetRequestsByIds( - const std::vector<int64_t>& request_ids, - UpdateCallback callback) { - DCHECK_NE(state_, StoreState::NOT_LOADED); - std::unique_ptr<UpdateRequestsResult> result( - new UpdateRequestsResult(state())); - - ItemActionStatus status; - // Make sure not to include the same request multiple times, while preserving - // the order of non-duplicated IDs in the result. - std::unordered_set<int64_t> processed_ids; - for (const auto& request_id : request_ids) { - if (!processed_ids.insert(request_id).second) - continue; - RequestsMap::iterator iter = requests_.find(request_id); - if (iter != requests_.end()) { - status = ItemActionStatus::SUCCESS; - result->updated_items.push_back(iter->second); - } else { - status = ItemActionStatus::NOT_FOUND; - } - result->item_statuses.push_back(std::make_pair(request_id, status)); - } - - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), std::move(result))); -} - -void RequestQueueInMemoryStore::AddRequest(const SavePageRequest& request, - AddCallback callback) { - DCHECK_NE(state_, StoreState::NOT_LOADED); - RequestsMap::iterator iter = requests_.find(request.request_id()); - ItemActionStatus status; - if (iter == requests_.end()) { - requests_.insert(iter, std::make_pair(request.request_id(), request)); - status = ItemActionStatus::SUCCESS; - } else { - status = ItemActionStatus::ALREADY_EXISTS; - } - - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), status)); -} - -void RequestQueueInMemoryStore::UpdateRequests( - const std::vector<SavePageRequest>& requests, - UpdateCallback callback) { - DCHECK_NE(state_, StoreState::NOT_LOADED); - std::unique_ptr<UpdateRequestsResult> result( - new UpdateRequestsResult(state())); - - ItemActionStatus status; - for (const auto& request : requests) { - RequestsMap::iterator iter = requests_.find(request.request_id()); - if (iter != requests_.end()) { - status = ItemActionStatus::SUCCESS; - iter->second = request; - result->updated_items.push_back(request); - } else { - status = ItemActionStatus::NOT_FOUND; - } - result->item_statuses.push_back( - std::make_pair(request.request_id(), status)); - } - - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), std::move(result))); -} - -void RequestQueueInMemoryStore::RemoveRequests( - const std::vector<int64_t>& request_ids, - UpdateCallback callback) { - DCHECK_NE(state_, StoreState::NOT_LOADED); - std::unique_ptr<UpdateRequestsResult> result( - new UpdateRequestsResult(StoreState::LOADED)); - - ItemActionStatus status; - // If we find a request, mark it as succeeded, and put it in the request list. - // Otherwise mark it as failed. - for (auto request_id : request_ids) { - RequestsMap::iterator iter = requests_.find(request_id); - if (iter != requests_.end()) { - status = ItemActionStatus::SUCCESS; - result->updated_items.push_back(iter->second); - requests_.erase(iter); - } else { - status = ItemActionStatus::NOT_FOUND; - } - result->item_statuses.push_back(std::make_pair(request_id, status)); - } - - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), std::move(result))); -} - -void RequestQueueInMemoryStore::Reset(ResetCallback callback) { - if (scenario_ != TestScenario::LOAD_FAILED_RESET_FAILED) { - requests_.clear(); - state_ = StoreState::NOT_LOADED; - scenario_ = TestScenario::SUCCESSFUL; - } else { - state_ = StoreState::FAILED_RESET; - } - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(callback), state_ == StoreState::NOT_LOADED)); -} - -StoreState RequestQueueInMemoryStore::state() const { - return state_; -} - -} // namespace offline_pages
diff --git a/components/offline_pages/core/background/request_queue_in_memory_store.h b/components/offline_pages/core/background/request_queue_in_memory_store.h deleted file mode 100644 index 7162016..0000000 --- a/components/offline_pages/core/background/request_queue_in_memory_store.h +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ -#define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ - -#include <stdint.h> - -#include <map> - -#include "base/macros.h" -#include "components/offline_pages/core/background/request_queue_store.h" -#include "components/offline_pages/core/background/save_page_request.h" - -namespace offline_pages { - -// Interface for classes storing save page requests. -class RequestQueueInMemoryStore : public RequestQueueStore { - public: - enum class TestScenario { - SUCCESSFUL, - LOAD_FAILED_RESET_SUCCESS, - LOAD_FAILED_RESET_FAILED, - }; - - RequestQueueInMemoryStore(); - explicit RequestQueueInMemoryStore(TestScenario scenario); - ~RequestQueueInMemoryStore() override; - - // RequestQueueStore implementaiton. - void Initialize(InitializeCallback callback) override; - void GetRequests(GetRequestsCallback callback) override; - void GetRequestsByIds(const std::vector<int64_t>& request_ids, - UpdateCallback callback) override; - void AddRequest(const SavePageRequest& offline_page, - AddCallback callback) override; - void UpdateRequests(const std::vector<SavePageRequest>& requests, - UpdateCallback callback) override; - void RemoveRequests(const std::vector<int64_t>& request_ids, - UpdateCallback callback) override; - void Reset(ResetCallback callback) override; - StoreState state() const override; - - private: - typedef std::map<int64_t, SavePageRequest> RequestsMap; - RequestsMap requests_; - StoreState state_; - TestScenario scenario_; - - DISALLOW_COPY_AND_ASSIGN(RequestQueueInMemoryStore); -}; - -} // namespace offline_pages - -#endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_
diff --git a/components/offline_pages/core/background/request_queue_store_sql.cc b/components/offline_pages/core/background/request_queue_store.cc similarity index 91% rename from components/offline_pages/core/background/request_queue_store_sql.cc rename to components/offline_pages/core/background/request_queue_store.cc index 05e5271..70e07a9 100644 --- a/components/offline_pages/core/background/request_queue_store_sql.cc +++ b/components/offline_pages/core/background/request_queue_store.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/offline_pages/core/background/request_queue_store_sql.h" +#include "components/offline_pages/core/background/request_queue_store.h" #include <unordered_set> #include <utility> @@ -196,7 +196,7 @@ if (statement.Step()) return MakeSavePageRequest(statement); - return std::unique_ptr<SavePageRequest>(nullptr); + return {}; } ItemActionStatus DeleteRequestById(sql::Database* db, int64_t request_id) { @@ -316,11 +316,16 @@ db->set_histogram_tag("BackgroundRequestQueue"); db->set_exclusive_locking(); - base::File::Error err; - if (!base::CreateDirectoryAndGetError(path.DirName(), &err)) - return false; - if (!db->Open(path)) - return false; + if (path.empty()) { + if (!db->OpenInMemory()) + return false; + } else { + base::File::Error err; + if (!base::CreateDirectoryAndGetError(path.DirName(), &err)) + return false; + if (!db->Open(path)) + return false; + } db->Preload(); return CreateSchema(db); @@ -481,20 +486,26 @@ } // anonymous namespace -RequestQueueStoreSQL::RequestQueueStoreSQL( - scoped_refptr<base::SequencedTaskRunner> background_task_runner, - const base::FilePath& path) +RequestQueueStore::RequestQueueStore( + scoped_refptr<base::SequencedTaskRunner> background_task_runner) : background_task_runner_(std::move(background_task_runner)), - db_file_path_(path.AppendASCII("RequestQueue.db")), state_(StoreState::NOT_LOADED), weak_ptr_factory_(this) {} -RequestQueueStoreSQL::~RequestQueueStoreSQL() { +RequestQueueStore::RequestQueueStore( + scoped_refptr<base::SequencedTaskRunner> background_task_runner, + const base::FilePath& path) + : RequestQueueStore(background_task_runner) { + DCHECK(!path.empty()); + db_file_path_ = path.AppendASCII("RequestQueue.db"); +} + +RequestQueueStore::~RequestQueueStore() { if (db_) background_task_runner_->DeleteSoon(FROM_HERE, db_.release()); } -void RequestQueueStoreSQL::Initialize(InitializeCallback callback) { +void RequestQueueStore::Initialize(InitializeCallback callback) { DCHECK(!db_); db_.reset(new sql::Database()); background_task_runner_->PostTask( @@ -502,11 +513,11 @@ base::BindOnce( &OpenConnectionSync, db_.get(), base::ThreadTaskRunnerHandle::Get(), db_file_path_, - base::BindOnce(&RequestQueueStoreSQL::OnOpenConnectionDone, + base::BindOnce(&RequestQueueStore::OnOpenConnectionDone, weak_ptr_factory_.GetWeakPtr(), std::move(callback)))); } -void RequestQueueStoreSQL::GetRequests(GetRequestsCallback callback) { +void RequestQueueStore::GetRequests(GetRequestsCallback callback) { DCHECK(db_); if (!CheckDb()) { std::vector<std::unique_ptr<SavePageRequest>> requests; @@ -522,7 +533,7 @@ base::ThreadTaskRunnerHandle::Get(), std::move(callback))); } -void RequestQueueStoreSQL::GetRequestsByIds( +void RequestQueueStore::GetRequestsByIds( const std::vector<int64_t>& request_ids, UpdateCallback callback) { if (!CheckDb()) { @@ -537,8 +548,8 @@ request_ids, std::move(callback))); } -void RequestQueueStoreSQL::AddRequest(const SavePageRequest& request, - AddCallback callback) { +void RequestQueueStore::AddRequest(const SavePageRequest& request, + AddCallback callback) { if (!CheckDb()) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -552,7 +563,7 @@ std::move(callback))); } -void RequestQueueStoreSQL::UpdateRequests( +void RequestQueueStore::UpdateRequests( const std::vector<SavePageRequest>& requests, UpdateCallback callback) { if (!CheckDb()) { @@ -567,9 +578,8 @@ std::move(callback))); } -void RequestQueueStoreSQL::RemoveRequests( - const std::vector<int64_t>& request_ids, - UpdateCallback callback) { +void RequestQueueStore::RemoveRequests(const std::vector<int64_t>& request_ids, + UpdateCallback callback) { if (!CheckDb()) { PostStoreErrorForAllIds(base::ThreadTaskRunnerHandle::Get(), request_ids, std::move(callback)); @@ -582,35 +592,40 @@ request_ids, std::move(callback))); } -void RequestQueueStoreSQL::Reset(ResetCallback callback) { +void RequestQueueStore::Reset(ResetCallback callback) { background_task_runner_->PostTask( - FROM_HERE, - base::BindOnce( - &ResetSync, db_.get(), db_file_path_, - base::ThreadTaskRunnerHandle::Get(), - base::BindOnce(&RequestQueueStoreSQL::OnResetDone, - weak_ptr_factory_.GetWeakPtr(), std::move(callback)))); + FROM_HERE, base::BindOnce(&ResetSync, db_.get(), db_file_path_, + base::ThreadTaskRunnerHandle::Get(), + base::BindOnce(&RequestQueueStore::OnResetDone, + weak_ptr_factory_.GetWeakPtr(), + std::move(callback)))); } -StoreState RequestQueueStoreSQL::state() const { +StoreState RequestQueueStore::state() const { return state_; } -void RequestQueueStoreSQL::OnOpenConnectionDone(InitializeCallback callback, - bool success) { +void RequestQueueStore::SetStateForTesting(StoreState state, bool reset_db) { + state_ = state; + if (reset_db) + db_.reset(nullptr); +} + +void RequestQueueStore::OnOpenConnectionDone(InitializeCallback callback, + bool success) { DCHECK(db_); state_ = success ? StoreState::LOADED : StoreState::FAILED_LOADING; std::move(callback).Run(success); } -void RequestQueueStoreSQL::OnResetDone(ResetCallback callback, bool success) { +void RequestQueueStore::OnResetDone(ResetCallback callback, bool success) { state_ = success ? StoreState::NOT_LOADED : StoreState::FAILED_RESET; db_.reset(); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), success)); } -bool RequestQueueStoreSQL::CheckDb() const { +bool RequestQueueStore::CheckDb() const { return db_ && state_ == StoreState::LOADED; }
diff --git a/components/offline_pages/core/background/request_queue_store.h b/components/offline_pages/core/background/request_queue_store.h index 93b698e..761edde 100644 --- a/components/offline_pages/core/background/request_queue_store.h +++ b/components/offline_pages/core/background/request_queue_store.h
@@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,16 +6,41 @@ #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_STORE_H_ #include <stdint.h> +#include <memory> #include <vector> #include "base/callback.h" +#include "base/files/file_path.h" +#include "base/memory/weak_ptr.h" #include "components/offline_pages/core/background/request_queue.h" +#include "components/offline_pages/core/background/request_queue_store.h" #include "components/offline_pages/core/background/save_page_request.h" #include "components/offline_pages/core/offline_store_types.h" +namespace base { +class SequencedTaskRunner; +} + +namespace sql { +class Database; +} + namespace offline_pages { -// Interface for classes storing save page requests. +// Persistent storage for the RequestQueue. +// +// This store has a history of schema updates. +// Original schema was delivered in M57. Since then the following changes +// happened: +// * In M58 original_url was added. +// * In M61 request_origin was added. +// * In M67 fail_state was added. +// +// TODO(romax): remove all activation_time related code the next we change the +// schema. +// +// Looking for procedure to update the schema, please refer to +// offline_page_metadata_store.h class RequestQueueStore { public: enum class UpdateStatus { @@ -24,8 +49,6 @@ FAILED, // Add or update attempt failed. }; - using UpdateCallback = RequestQueue::UpdateCallback; - typedef base::OnceCallback<void(bool /* success */)> InitializeCallback; typedef base::OnceCallback<void(bool /* success */)> ResetCallback; typedef base::OnceCallback<void( @@ -33,42 +56,85 @@ std::vector<std::unique_ptr<SavePageRequest>> /* requests */)> GetRequestsCallback; typedef base::OnceCallback<void(ItemActionStatus)> AddCallback; + using UpdateCallback = RequestQueue::UpdateCallback; - virtual ~RequestQueueStore(){}; + RequestQueueStore( + scoped_refptr<base::SequencedTaskRunner> background_task_runner, + const base::FilePath& database_dir); + + virtual ~RequestQueueStore(); // Initializes the store. Should be called before any other methods. - virtual void Initialize(InitializeCallback callback) = 0; + // Virtual for testing only. + virtual void Initialize(InitializeCallback callback); // Gets all of the requests from the store. - virtual void GetRequests(GetRequestsCallback callback) = 0; + void GetRequests(GetRequestsCallback callback); // Gets requests with specified IDs from the store. UpdateCallback is used // instead of GetRequestsCallback to indicate which requests where not found. - virtual void GetRequestsByIds(const std::vector<int64_t>& request_ids, - UpdateCallback callback) = 0; + // Note: current implementation of this method makes a SQL query per ID. This + // is OK as long as number of IDs stays low, which is a typical case. + // Implementation should be revisited in case that presumption changes. + void GetRequestsByIds(const std::vector<int64_t>& request_ids, + UpdateCallback callback); // Asynchronously adds request in store. Fails if request with the same // offline ID already exists. - virtual void AddRequest(const SavePageRequest& offline_page, - AddCallback callback) = 0; + void AddRequest(const SavePageRequest& offline_page, AddCallback callback); // Asynchronously updates requests in store. - virtual void UpdateRequests(const std::vector<SavePageRequest>& requests, - UpdateCallback callback) = 0; + void UpdateRequests(const std::vector<SavePageRequest>& requests, + UpdateCallback callback); // Asynchronously removes requests from the store using their IDs. // Result of the update, and a number of removed pages is passed in the // callback. // Result of remove should be false, when one of the provided items couldn't // be deleted, e.g. because it was missing. - virtual void RemoveRequests(const std::vector<int64_t>& request_ids, - UpdateCallback callback) = 0; + void RemoveRequests(const std::vector<int64_t>& request_ids, + UpdateCallback callback); // Resets the store (removes any existing data). - virtual void Reset(ResetCallback callback) = 0; + // Virtual for testing only. + virtual void Reset(ResetCallback callback); // Gets the store state. - virtual StoreState state() const = 0; + StoreState state() const; + + protected: + // Constructs an in-memory store. Used for testing only. + explicit RequestQueueStore( + scoped_refptr<base::SequencedTaskRunner> task_runner); + + // Helper function used to force incorrect state for testing purposes. + void SetStateForTesting(StoreState state, bool reset_db); + + private: + RequestQueueStore& operator=(const RequestQueueStore&) = delete; + + // Used to finalize DB connection initialization. + void OnOpenConnectionDone(InitializeCallback callback, bool success); + + // Used to finalize DB connection reset. + void OnResetDone(ResetCallback callback, bool success); + + // Helper function to return immediately if no database is found. + bool CheckDb() const; + + // Background thread where all SQL access should be run. + scoped_refptr<base::SequencedTaskRunner> background_task_runner_; + + // Path to the database on disk. + base::FilePath db_file_path_; + + // Database connection. + std::unique_ptr<sql::Database> db_; + + // State of the store. + StoreState state_; + + base::WeakPtrFactory<RequestQueueStore> weak_ptr_factory_; }; } // namespace offline_pages
diff --git a/components/offline_pages/core/background/request_queue_store_sql.h b/components/offline_pages/core/background/request_queue_store_sql.h deleted file mode 100644 index 1e67ca9..0000000 --- a/components/offline_pages/core/background/request_queue_store_sql.h +++ /dev/null
@@ -1,92 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_ -#define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_ - -#include <stdint.h> -#include <memory> -#include <vector> - -#include "base/files/file_path.h" -#include "base/memory/weak_ptr.h" -#include "components/offline_pages/core/background/request_queue_store.h" - -namespace base { -class SequencedTaskRunner; -} - -namespace sql { -class Database; -} - -namespace offline_pages { - -// SQLite implementation of RequestQueueStore. -// -// This store has a history of schema updates. -// Original schema was delivered in M57. Since then the following changes -// happened: -// * In M58 original_url was added. -// * In M61 request_origin was added. -// * In M67 fail_state was added. -// -// TODO(romax): remove all activation_time related code the next we change the -// schema. -// -// Looking for procedure to update the schema, please refer to -// offline_page_metadata_store.h -class RequestQueueStoreSQL : public RequestQueueStore { - public: - RequestQueueStoreSQL( - scoped_refptr<base::SequencedTaskRunner> background_task_runner, - const base::FilePath& database_dir); - ~RequestQueueStoreSQL() override; - - // RequestQueueStore implementation. - void Initialize(InitializeCallback callback) override; - void GetRequests(GetRequestsCallback callback) override; - // Note: current implementation of this method makes a SQL query per ID. This - // is OK as long as number of IDs stays low, which is a typical case. - // Implementation should be revisited in case that presumption changes. - void GetRequestsByIds(const std::vector<int64_t>& request_ids, - UpdateCallback callback) override; - void AddRequest(const SavePageRequest& offline_page, - AddCallback callback) override; - void UpdateRequests(const std::vector<SavePageRequest>& requests, - UpdateCallback callback) override; - void RemoveRequests(const std::vector<int64_t>& request_ids, - UpdateCallback callback) override; - void Reset(ResetCallback callback) override; - StoreState state() const override; - - private: - // Used to finalize DB connection initialization. - void OnOpenConnectionDone(InitializeCallback callback, bool success); - - // Used to finalize DB connection reset. - void OnResetDone(ResetCallback callback, bool success); - - // Helper function to return immediately if no database is found. - bool CheckDb() const; - - // Background thread where all SQL access should be run. - scoped_refptr<base::SequencedTaskRunner> background_task_runner_; - - // Path to the database on disk. - base::FilePath db_file_path_; - - // Database connection. - std::unique_ptr<sql::Database> db_; - - // State of the store. - StoreState state_; - - base::WeakPtrFactory<RequestQueueStoreSQL> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(RequestQueueStoreSQL); -}; - -} // namespace offline_pages - -#endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_
diff --git a/components/offline_pages/core/background/request_queue_store_unittest.cc b/components/offline_pages/core/background/request_queue_store_unittest.cc index 78fa4ca6..f22508f 100644 --- a/components/offline_pages/core/background/request_queue_store_unittest.cc +++ b/components/offline_pages/core/background/request_queue_store_unittest.cc
@@ -9,11 +9,9 @@ #include "base/bind.h" #include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "components/offline_pages/core/background/request_queue.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" -#include "components/offline_pages/core/background/request_queue_store_sql.h" #include "components/offline_pages/core/background/save_page_request.h" #include "sql/database.h" #include "sql/statement.h" @@ -48,19 +46,19 @@ connection.Open(file.Append(FILE_PATH_LITERAL("RequestQueue.db")))); ASSERT_TRUE(connection.is_open()); ASSERT_TRUE(connection.BeginTransaction()); - ASSERT_TRUE(connection.Execute( - "CREATE TABLE " REQUEST_QUEUE_TABLE_NAME - " (request_id INTEGER PRIMARY KEY NOT NULL," - " creation_time INTEGER NOT NULL," - " activation_time INTEGER NOT NULL DEFAULT 0," - " last_attempt_time INTEGER NOT NULL DEFAULT 0," - " started_attempt_count INTEGER NOT NULL," - " completed_attempt_count INTEGER NOT NULL," - " state INTEGER NOT NULL DEFAULT 0," - " url VARCHAR NOT NULL," - " client_namespace VARCHAR NOT NULL," - " client_id VARCHAR NOT NULL" - ")")); + ASSERT_TRUE( + connection.Execute("CREATE TABLE " REQUEST_QUEUE_TABLE_NAME + " (request_id INTEGER PRIMARY KEY NOT NULL," + " creation_time INTEGER NOT NULL," + " activation_time INTEGER NOT NULL DEFAULT 0," + " last_attempt_time INTEGER NOT NULL DEFAULT 0," + " started_attempt_count INTEGER NOT NULL," + " completed_attempt_count INTEGER NOT NULL," + " state INTEGER NOT NULL DEFAULT 0," + " url VARCHAR NOT NULL," + " client_namespace VARCHAR NOT NULL," + " client_id VARCHAR NOT NULL" + ")")); ASSERT_TRUE(connection.CommitTransaction()); sql::Statement statement(connection.GetUniqueStatement( @@ -183,8 +181,6 @@ connection.DoesColumnExist(REQUEST_QUEUE_TABLE_NAME, "fail_state")); } -} // namespace - // Class that serves as a base for testing different implementations of the // |RequestQueueStore|. Specific implementations extend the templatized version // of this class and provide appropriate store factory. @@ -231,7 +227,7 @@ std::unique_ptr<UpdateRequestsResult> last_update_result_; std::vector<std::unique_ptr<SavePageRequest>> last_requests_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; + scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; base::ThreadTaskRunnerHandle task_runner_handle_; }; @@ -239,7 +235,7 @@ : last_result_(LastResult::RESULT_NONE), last_update_status_(UpdateStatus::FAILED), last_add_status_(ItemActionStatus::NOT_FOUND), - task_runner_(new base::TestSimpleTaskRunner), + task_runner_(new base::TestMockTimeTaskRunner), task_runner_handle_(task_runner_) { EXPECT_TRUE(temp_directory_.CreateUniqueTempDir()); } @@ -297,91 +293,35 @@ last_result_ = result ? LastResult::RESULT_TRUE : LastResult::RESULT_FALSE; } -// Defines interface for the store factory. -class RequestQueueStoreFactory { - public: - virtual RequestQueueStore* BuildStore(const base::FilePath& path) = 0; - virtual RequestQueueStore* BuildStoreWithOldSchema( - const base::FilePath& path, int version) = 0; -}; - -// Implements a store factory for in memory store. -class RequestQueueInMemoryStoreFactory : public RequestQueueStoreFactory { - public: - RequestQueueStore* BuildStore(const base::FilePath& path) override { - RequestQueueStore* store = new RequestQueueInMemoryStore(); - return store; - } - - RequestQueueStore* BuildStoreWithOldSchema(const base::FilePath& path, - int version) override { - return nullptr; - } -}; - -// Implements a store factory for SQLite based implementation of the store. -class RequestQueueStoreSQLFactory : public RequestQueueStoreFactory { - public: - RequestQueueStore* BuildStore(const base::FilePath& path) override { - RequestQueueStore* store = - new RequestQueueStoreSQL(base::ThreadTaskRunnerHandle::Get(), path); - return store; - } - - RequestQueueStore* BuildStoreWithOldSchema(const base::FilePath& path, - int version) override { - if (version == 57) { - BuildTestStoreWithSchemaFromM57(path); - } else if (version == 58) { - BuildTestStoreWithSchemaFromM58(path); - } else if (version == 61) { - BuildTestStoreWithSchemaFromM61(path); - } - - RequestQueueStore* store = - new RequestQueueStoreSQL(base::ThreadTaskRunnerHandle::Get(), path); - return store; - } -}; - // Defines a store test fixture templatized by the store factory. -template <typename T> class RequestQueueStoreTest : public RequestQueueStoreTestBase { public: - std::unique_ptr<RequestQueueStore> BuildStore(); - std::unique_ptr<RequestQueueStore> BuildStoreWithOldSchema(int version); + std::unique_ptr<RequestQueueStore> BuildStore() { + return std::make_unique<RequestQueueStore>( + base::ThreadTaskRunnerHandle::Get(), temp_directory_.GetPath()); + } + std::unique_ptr<RequestQueueStore> BuildStoreWithOldSchema(int version) { + if (version == 57) { + BuildTestStoreWithSchemaFromM57(temp_directory_.GetPath()); + } else if (version == 58) { + BuildTestStoreWithSchemaFromM58(temp_directory_.GetPath()); + } else if (version == 61) { + BuildTestStoreWithSchemaFromM61(temp_directory_.GetPath()); + } + + return std::make_unique<RequestQueueStore>( + base::ThreadTaskRunnerHandle::Get(), temp_directory_.GetPath()); + } protected: - T factory_; }; -template <typename T> -std::unique_ptr<RequestQueueStore> RequestQueueStoreTest<T>::BuildStore() { - std::unique_ptr<RequestQueueStore> store( - factory_.BuildStore(temp_directory_.GetPath())); - return store; -} - -template <typename T> -std::unique_ptr<RequestQueueStore> -RequestQueueStoreTest<T>::BuildStoreWithOldSchema(int version) { - std::unique_ptr<RequestQueueStore> store( - factory_.BuildStoreWithOldSchema(temp_directory_.GetPath(), version)); - return store; -} - -// |StoreTypes| lists all factories, based on which the tests will be created. -typedef testing::Types<RequestQueueInMemoryStoreFactory, - RequestQueueStoreSQLFactory> - StoreTypes; - // This portion causes test fixtures to be defined. // Notice that in the store we are using "this->" to refer to the methods // defined on the |RequestQuieueStoreBaseTest| class. That's by design. -TYPED_TEST_CASE(RequestQueueStoreTest, StoreTypes); -TYPED_TEST(RequestQueueStoreTest, UpgradeFromVersion57Store) { - std::unique_ptr<RequestQueueStore> store(this->BuildStoreWithOldSchema(57)); +TEST_F(RequestQueueStoreTest, UpgradeFromVersion57Store) { + std::unique_ptr<RequestQueueStore> store = BuildStoreWithOldSchema(57); // In-memory store does not support upgrading. if (!store) return; @@ -397,8 +337,8 @@ EXPECT_EQ(GURL(), this->last_requests()[0]->original_url()); } -TYPED_TEST(RequestQueueStoreTest, UpgradeFromVersion58Store) { - std::unique_ptr<RequestQueueStore> store(this->BuildStoreWithOldSchema(58)); +TEST_F(RequestQueueStoreTest, UpgradeFromVersion58Store) { + std::unique_ptr<RequestQueueStore> store(BuildStoreWithOldSchema(58)); // In-memory store does not support upgrading. if (!store) return; @@ -415,8 +355,8 @@ EXPECT_EQ("", this->last_requests()[0]->request_origin()); } -TYPED_TEST(RequestQueueStoreTest, UpgradeFromVersion61Store) { - std::unique_ptr<RequestQueueStore> store(this->BuildStoreWithOldSchema(61)); +TEST_F(RequestQueueStoreTest, UpgradeFromVersion61Store) { + std::unique_ptr<RequestQueueStore> store(BuildStoreWithOldSchema(61)); // In-memory store does not support upgrading. if (!store) return; @@ -434,7 +374,7 @@ EXPECT_EQ(0, static_cast<int>(this->last_requests()[0]->fail_state())); } -TYPED_TEST(RequestQueueStoreTest, GetRequestsEmpty) { +TEST_F(RequestQueueStoreTest, GetRequestsEmpty) { std::unique_ptr<RequestQueueStore> store(this->BuildStore()); this->InitializeStore(store.get()); @@ -446,7 +386,7 @@ ASSERT_TRUE(this->last_requests().empty()); } -TYPED_TEST(RequestQueueStoreTest, GetRequestsByIds) { +TEST_F(RequestQueueStoreTest, GetRequestsByIds) { std::unique_ptr<RequestQueueStore> store(this->BuildStore()); this->InitializeStore(store.get()); @@ -507,7 +447,7 @@ EXPECT_EQ(request1, this->last_update_result()->updated_items.at(0)); } -TYPED_TEST(RequestQueueStoreTest, AddRequest) { +TEST_F(RequestQueueStoreTest, AddRequest) { std::unique_ptr<RequestQueueStore> store(this->BuildStore()); this->InitializeStore(store.get()); @@ -552,7 +492,7 @@ ASSERT_EQ(1ul, this->last_requests().size()); } -TYPED_TEST(RequestQueueStoreTest, UpdateRequest) { +TEST_F(RequestQueueStoreTest, UpdateRequest) { std::unique_ptr<RequestQueueStore> store(this->BuildStore()); this->InitializeStore(store.get()); @@ -606,7 +546,7 @@ ASSERT_EQ(updated_request, *(this->last_requests()[0].get())); } -TYPED_TEST(RequestQueueStoreTest, RemoveRequests) { +TEST_F(RequestQueueStoreTest, RemoveRequests) { std::unique_ptr<RequestQueueStore> store(this->BuildStore()); this->InitializeStore(store.get()); @@ -670,7 +610,7 @@ EXPECT_EQ(0UL, this->last_update_result()->updated_items.size()); } -TYPED_TEST(RequestQueueStoreTest, ResetStore) { +TEST_F(RequestQueueStoreTest, ResetStore) { std::unique_ptr<RequestQueueStore> store(this->BuildStore()); this->InitializeStore(store.get()); @@ -698,12 +638,9 @@ ASSERT_TRUE(this->last_requests().empty()); } -class RequestQueueStoreSQLTest - : public RequestQueueStoreTest<RequestQueueStoreSQLFactory> {}; - // Makes sure that persistent DB is actually persisting requests across store // restarts. -TEST_F(RequestQueueStoreSQLTest, SaveCloseReopenRead) { +TEST_F(RequestQueueStoreTest, SaveCloseReopenRead) { std::unique_ptr<RequestQueueStore> store(BuildStore()); this->InitializeStore(store.get()); @@ -731,4 +668,5 @@ ASSERT_TRUE(original_request == *(this->last_requests().at(0).get())); } -} // offline_pages +} // namespace +} // namespace offline_pages
diff --git a/components/offline_pages/core/background/request_queue_task_test_base.cc b/components/offline_pages/core/background/request_queue_task_test_base.cc new file mode 100644 index 0000000..df6677d --- /dev/null +++ b/components/offline_pages/core/background/request_queue_task_test_base.cc
@@ -0,0 +1,29 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/offline_pages/core/background/request_queue_task_test_base.h" + +namespace offline_pages { + +RequestQueueTaskTestBase::RequestQueueTaskTestBase() + : task_runner_(new base::TestMockTimeTaskRunner), + task_runner_handle_(task_runner_) {} + +RequestQueueTaskTestBase::~RequestQueueTaskTestBase() = default; + +void RequestQueueTaskTestBase::TearDown() { + store_.Close(); + PumpLoop(); +} + +void RequestQueueTaskTestBase::PumpLoop() { + task_runner_->RunUntilIdle(); +} + +void RequestQueueTaskTestBase::InitializeStore() { + store_.Initialize(base::BindOnce([](bool success) { ASSERT_TRUE(success); })); + PumpLoop(); +} + +} // namespace offline_pages
diff --git a/components/offline_pages/core/background/request_queue_task_test_base.h b/components/offline_pages/core/background/request_queue_task_test_base.h new file mode 100644 index 0000000..f698cfe --- /dev/null +++ b/components/offline_pages/core/background/request_queue_task_test_base.h
@@ -0,0 +1,35 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_TASK_TEST_BASE_H_ +#define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_TASK_TEST_BASE_H_ + +#include "base/test/test_mock_time_task_runner.h" +#include "base/threading/thread_task_runner_handle.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace offline_pages { + +class RequestQueueTaskTestBase : public testing::Test { + public: + RequestQueueTaskTestBase(); + ~RequestQueueTaskTestBase() override; + + void TearDown() override; + void PumpLoop(); + + void InitializeStore(); + + scoped_refptr<base::TestMockTimeTaskRunner> task_runner() { + return task_runner_; + } + + protected: + scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; + base::ThreadTaskRunnerHandle task_runner_handle_; + TestRequestQueueStore store_; +}; +} // namespace offline_pages +#endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_TASK_TEST_BASE_H_
diff --git a/components/offline_pages/core/background/request_queue_unittest.cc b/components/offline_pages/core/background/request_queue_unittest.cc index a19ed34..9d99c28f8 100644 --- a/components/offline_pages/core/background/request_queue_unittest.cc +++ b/components/offline_pages/core/background/request_queue_unittest.cc
@@ -8,15 +8,16 @@ #include <utility> #include "base/bind.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "components/offline_pages/core/background/device_conditions.h" #include "components/offline_pages/core/background/offliner_policy.h" #include "components/offline_pages/core/background/request_coordinator.h" #include "components/offline_pages/core/background/request_coordinator_event_logger.h" #include "components/offline_pages/core/background/request_notifier.h" -#include "components/offline_pages/core/background/request_queue_in_memory_store.h" +#include "components/offline_pages/core/background/request_queue_store.h" #include "components/offline_pages/core/background/save_page_request.h" +#include "components/offline_pages/core/background/test_request_queue_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace offline_pages { @@ -92,6 +93,10 @@ // Test overrides. void SetUp() override; + void TearDown() override { + store_->Close(); + PumpLoop(); + } void PumpLoop(); @@ -139,7 +144,8 @@ std::vector<std::unique_ptr<SavePageRequest>> last_requests_; std::unique_ptr<RequestQueue> queue_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; + TestRequestQueueStore* store_; // Owned by queue_. + scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; base::ThreadTaskRunnerHandle task_runner_handle_; }; @@ -147,14 +153,14 @@ : last_add_result_(AddRequestResult::STORE_FAILURE), last_update_result_(UpdateRequestResult::STORE_FAILURE), last_get_requests_result_(GetRequestsResult::STORE_FAILURE), - task_runner_(new base::TestSimpleTaskRunner), + task_runner_(new base::TestMockTimeTaskRunner), task_runner_handle_(task_runner_) {} RequestQueueTest::~RequestQueueTest() {} void RequestQueueTest::SetUp() { - std::unique_ptr<RequestQueueInMemoryStore> store( - new RequestQueueInMemoryStore()); + auto store = std::make_unique<TestRequestQueueStore>(); + store_ = store.get(); queue_.reset(new RequestQueue(std::move(store))); }
diff --git a/components/offline_pages/core/background/test_request_queue_store.cc b/components/offline_pages/core/background/test_request_queue_store.cc new file mode 100644 index 0000000..027e13f --- /dev/null +++ b/components/offline_pages/core/background/test_request_queue_store.cc
@@ -0,0 +1,58 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/offline_pages/core/background/test_request_queue_store.h" + +#include "base/threading/thread_task_runner_handle.h" +#include "components/offline_pages/core/background/request_queue_store.h" + +namespace offline_pages { + +TestRequestQueueStore::TestRequestQueueStore() + : RequestQueueStore(base::ThreadTaskRunnerHandle::Get()) {} + +TestRequestQueueStore::~TestRequestQueueStore() { + // Delete the database and run all tasks. + SetStateForTesting(StoreState::NOT_LOADED, true); +} + +void TestRequestQueueStore::Close() { + SetStateForTesting(StoreState::NOT_LOADED, true); +} + +void TestRequestQueueStore::set_force_initialize_fail() { + force_initialize_fail_ = true; +} + +bool TestRequestQueueStore::force_initialize_fail() { + return force_initialize_fail_; +} + +void TestRequestQueueStore::set_resume_after_reset() { + resume_after_reset_ = true; +} + +void TestRequestQueueStore::Initialize(InitializeCallback callback) { + if (force_initialize_fail_) { + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), false)); + } else { + RequestQueueStore::Initialize(std::move(callback)); + } +} + +void TestRequestQueueStore::Reset(ResetCallback callback) { + if (force_initialize_fail_ && resume_after_reset_) { + force_initialize_fail_ = false; + SetStateForTesting(StoreState::NOT_LOADED, false); + } else if (force_initialize_fail_) { + SetStateForTesting(StoreState::FAILED_RESET, false); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), false)); + return; + } + RequestQueueStore::Reset(std::move(callback)); +} + +} // namespace offline_pages
diff --git a/components/offline_pages/core/background/test_request_queue_store.h b/components/offline_pages/core/background/test_request_queue_store.h new file mode 100644 index 0000000..44ef51d --- /dev/null +++ b/components/offline_pages/core/background/test_request_queue_store.h
@@ -0,0 +1,43 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_TEST_REQUEST_QUEUE_STORE_H_ +#define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_TEST_REQUEST_QUEUE_STORE_H_ + +#include "base/test/test_mock_time_task_runner.h" +#include "components/offline_pages/core/background/request_queue_store.h" + +namespace offline_pages { + +// Wraps RequestQueueStore for easy use in tests. Stores data in memory and +// provides additional testing functionality. +class TestRequestQueueStore : public RequestQueueStore { + public: + TestRequestQueueStore(); + ~TestRequestQueueStore() override; + + void Close(); + + // RequestQueueStore implementation. + + void Initialize(InitializeCallback callback) override; + void Reset(ResetCallback callback) override; + + // Test functionality. + + // Forces initialization failure on the database. + void set_force_initialize_fail(); + bool force_initialize_fail(); + + // In conjunction with set_force_initialize_fail, this allows the database + // to initialize after Reset() is called. + void set_resume_after_reset(); + + private: + bool resume_after_reset_ = false; + bool force_initialize_fail_ = false; +}; +} // namespace offline_pages + +#endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_TEST_REQUEST_QUEUE_STORE_H_
diff --git a/components/offline_pages/core/prefetch/prefetch_request_test_base.cc b/components/offline_pages/core/prefetch/prefetch_request_test_base.cc index 4eb3c92..8e6ce55 100644 --- a/components/offline_pages/core/prefetch/prefetch_request_test_base.cc +++ b/components/offline_pages/core/prefetch/prefetch_request_test_base.cc
@@ -88,12 +88,7 @@ network::TestURLLoaderFactory::PendingRequest* PrefetchRequestTestBase::GetPendingRequest(size_t index) { - if (index >= test_url_loader_factory_.pending_requests()->size()) - return nullptr; - network::TestURLLoaderFactory::PendingRequest* request = - &(*test_url_loader_factory_.pending_requests())[index]; - DCHECK(request); - return request; + return test_url_loader_factory_.GetPendingRequest(index); } std::string PrefetchRequestTestBase::GetExperiementHeaderValue(
diff --git a/components/offline_pages/core/prefetch/prefetch_task_test_base.cc b/components/offline_pages/core/prefetch/prefetch_task_test_base.cc index 2d9c71f..ecc3bae 100644 --- a/components/offline_pages/core/prefetch/prefetch_task_test_base.cc +++ b/components/offline_pages/core/prefetch/prefetch_task_test_base.cc
@@ -76,11 +76,7 @@ network::TestURLLoaderFactory::PendingRequest* PrefetchTaskTestBase::GetPendingRequest(size_t index) { - if (index >= test_url_loader_factory_.pending_requests()->size()) - return nullptr; - auto* request = &(*test_url_loader_factory_.pending_requests())[index]; - DCHECK(request); - return request; + return test_url_loader_factory_.GetPendingRequest(index); } } // namespace offline_pages
diff --git a/components/offline_pages/core/prefetch/test_download_service.cc b/components/offline_pages/core/prefetch/test_download_service.cc index df0ab3c..d468d146 100644 --- a/components/offline_pages/core/prefetch/test_download_service.cc +++ b/components/offline_pages/core/prefetch/test_download_service.cc
@@ -69,7 +69,8 @@ const int file_size = static_cast<int>(test_file_data_.size()); CHECK_EQ(file_size, base::WriteFile(path, test_file_data_.data(), file_size)); client_->OnDownloadSucceeded( - guid, download::CompletionInfo(path, test_file_data_.size())); + guid, download::CompletionInfo(path, test_file_data_.size(), + std::vector<GURL>(), nullptr)); } void TestDownloadService::SetTestFileData(const std::string& data) {
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 5a1046d..1f98d9f 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -13273,6 +13273,23 @@ This policy is only effective when the <ph name="CHROME_REPORTING_EXTENSION_NAME">Chrome Reporting Extension</ph> is enabled, and the machine is enrolled with <ph name="MACHINE_LEVEL_USER_CLOUD_POLICY_ENROLLMENT_TOKEN_POLICY_NAME">MachineLevelUserCloudPolicyEnrollmentToken</ph>.''' }, + { + 'name': 'EnterpriseHardwarePlatformAPIEnabled', + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['chrome.*:71-', 'chrome_os:71-', 'android:71-'], + 'features': { + 'dynamic_refresh': True, + 'per_profile': True, + }, + 'example_value': True, + 'id': 483, + 'caption': '''Enables the Hardware Platform API to policy-installed extensions''', + 'tags': [], + 'desc': '''When this policy is set to enabled, extensions installed by enterprise policy are allowed to use the Enterprise Hardware Platform API. + When this policy is set to disabled or not set, no extensions are allowed to use the Enterprise Hardware Platform API. + This policy also applies to component extensions such as the Hangout Services extension.''', + }, ], 'messages': { @@ -13414,5 +13431,5 @@ }, 'placeholders': [], 'deleted_policy_ids': [412], - 'highest_id_currently_used': 482 + 'highest_id_currently_used': 483 }
diff --git a/components/previews/core/previews_experiments.cc b/components/previews/core/previews_experiments.cc index 2cf69b7..3ccccad 100644 --- a/components/previews/core/previews_experiments.cc +++ b/components/previews/core/previews_experiments.cc
@@ -137,6 +137,13 @@ 60 * 5)); } +base::TimeDelta LitePagePreviewsNavigationTimeoutDuration() { + return base::TimeDelta::FromMilliseconds( + base::GetFieldTrialParamByFeatureAsInt(features::kLitePageServerPreviews, + "navigation_timeout_milliseconds", + 30 * 1000)); +} + std::vector<std::string> LitePagePreviewsBlacklistedPathSuffixes() { const std::string csv = base::GetFieldTrialParamValueByFeature( features::kLitePageServerPreviews, "blacklisted_path_suffixes");
diff --git a/components/previews/core/previews_experiments.h b/components/previews/core/previews_experiments.h index 0419fe14..ad2f3b1 100644 --- a/components/previews/core/previews_experiments.h +++ b/components/previews/core/previews_experiments.h
@@ -89,6 +89,10 @@ // shown as a preview. base::TimeDelta OfflinePreviewFreshnessDuration(); +// The amount of time that a Server Lite Page Preview navigation can take before +// it is killed and the original page is loaded. +base::TimeDelta LitePagePreviewsNavigationTimeoutDuration(); + // The host for Lite Page server previews. GURL GetLitePagePreviewsDomainURL();
diff --git a/components/security_interstitials_strings.grdp b/components/security_interstitials_strings.grdp index 077324b..2b2ca8d 100644 --- a/components/security_interstitials_strings.grdp +++ b/components/security_interstitials_strings.grdp
@@ -397,7 +397,7 @@ These charges could be one-time or recurring and may not be obvious. </message> <message name="IDS_BILLING_PRIMARY_BUTTON" desc="The text for the billing interstitial primary button."> - Go Back + Go back </message> <message name="IDS_BILLING_PROCEED_BUTTON" desc="The text for the billing interstitial proceed button."> Proceed
diff --git a/components/signin/core/browser/android/BUILD.gn b/components/signin/core/browser/android/BUILD.gn index 46c178e..69db557 100644 --- a/components/signin/core/browser/android/BUILD.gn +++ b/components/signin/core/browser/android/BUILD.gn
@@ -42,7 +42,7 @@ junit_binary("components_signin_junit_tests") { java_files = [ - "junit/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java", + "junit/src/org/chromium/components/signin/test/AccountManagerFacadeRobolectricTest.java", "junit/src/org/chromium/components/signin/test/PatternMatcherTest.java", ] deps = [ @@ -56,6 +56,22 @@ ] } +android_library("signin_javatests") { + testonly = true + deps = [ + ":java", + ":signin_java_test_support", + "//base:base_java", + "//base:base_java_test_support", + "//third_party/android_deps:android_support_annotations_java", + "//third_party/jsr-305:jsr_305_javalib", + "//third_party/junit", + "//third_party/mockito:mockito_java", + ] + + java_files = [ "javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java" ] +} + android_library("signin_java_test_support") { testonly = true deps = [
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerFacade.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerFacade.java index 93fc386..27868ce9 100644 --- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerFacade.java +++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerFacade.java
@@ -283,6 +283,16 @@ } /** + * Returns whether the account cache has already been populated. {@link #getGoogleAccounts()} + * and similar methods will return instantly if the cache has been populated, otherwise these + * methods may block waiting for the cache to be populated. + */ + @AnyThread + public boolean isCachePopulated() { + return mFilteredAccounts.get() != null; + } + + /** * Retrieves all Google accounts on the device. * * @throws AccountManagerDelegateException if Google Play Services are out of date,
diff --git a/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java new file mode 100644 index 0000000..a8823d2 --- /dev/null +++ b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java
@@ -0,0 +1,53 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.components.signin.test; + +import static org.mockito.Mockito.doAnswer; + +import android.accounts.Account; +import android.support.test.filters.SmallTest; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; + +import org.chromium.base.test.BaseJUnit4ClassRunner; +import org.chromium.components.signin.AccountManagerDelegate; +import org.chromium.components.signin.AccountManagerDelegateException; +import org.chromium.components.signin.AccountManagerFacade; + +import java.util.concurrent.CountDownLatch; + +/** + * Tests for {@link AccountManagerFacade}. See also {@link AccountManagerFacadeRobolectricTest}. + */ +@RunWith(BaseJUnit4ClassRunner.class) +public class AccountManagerFacadeTest { + @Test + @SmallTest + public void testIsCachePopulated() throws AccountManagerDelegateException { + AccountManagerDelegate delegate = Mockito.mock(AccountManagerDelegate.class); + + final Account account = AccountManagerFacade.createAccountFromName("test@gmail.com"); + final CountDownLatch blockGetAccounts = new CountDownLatch(1); + doAnswer(invocation -> { + // Block background thread that's trying to get accounts from the delegate. + blockGetAccounts.await(); + return new Account[] {account}; + }).when(delegate).getAccountsSync(); + + AccountManagerFacade.overrideAccountManagerFacadeForTests(delegate); + AccountManagerFacade facade = AccountManagerFacade.get(); + + // Cache shouldn't be populated until getAccountsSync is unblocked. + Assert.assertFalse(facade.isCachePopulated()); + + blockGetAccounts.countDown(); + // Wait for cache population to finish. + AccountManagerFacade.get().getGoogleAccounts(); + Assert.assertTrue(facade.isCachePopulated()); + } +}
diff --git a/components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java b/components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeRobolectricTest.java similarity index 98% rename from components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java rename to components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeRobolectricTest.java index b0c9af7..312baf0 100644 --- a/components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java +++ b/components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeRobolectricTest.java
@@ -38,12 +38,12 @@ import java.util.concurrent.atomic.AtomicInteger; /** - * Test class for {@link AccountManagerFacade}. + * Robolectric tests for {@link AccountManagerFacade}. See also {@link AccountManagerFacadeTest}. */ @RunWith(BaseRobolectricTestRunner.class) @Config(manifest = Config.NONE, shadows = {CustomShadowAsyncTask.class, CustomShadowUserManager.class}) -public class AccountManagerFacadeTest { +public class AccountManagerFacadeRobolectricTest { @Rule public UiThreadTestRule mRule = new UiThreadTestRule();
diff --git a/components/signin/core/browser/signin_manager.cc b/components/signin/core/browser/signin_manager.cc index 9da57fdc..c27e9797 100644 --- a/components/signin/core/browser/signin_manager.cc +++ b/components/signin/core/browser/signin_manager.cc
@@ -40,7 +40,6 @@ prohibit_signout_(false), type_(SIGNIN_TYPE_NONE), client_(client), - diagnostics_client_(nullptr), token_service_(token_service), cookie_manager_service_(cookie_manager_service), account_consistency_(account_consistency), @@ -459,11 +458,6 @@ } void SigninManager::FireGoogleSigninSucceeded() { - if (diagnostics_client_) { - diagnostics_client_->WillFireGoogleSigninSucceeded( - GetAuthenticatedAccountInfo()); - } - std::string account_id = GetAuthenticatedAccountId(); std::string email = GetAuthenticatedAccountInfo().email; for (auto& observer : observer_list_) { @@ -475,10 +469,6 @@ void SigninManager::FireGoogleSignedOut(const std::string& account_id, const AccountInfo& account_info) { - if (diagnostics_client_) { - diagnostics_client_->WillFireGoogleSignedOut(account_info); - } - for (auto& observer : observer_list_) { observer.GoogleSignedOut(account_id, account_info.email); observer.GoogleSignedOut(account_info);
diff --git a/components/signin/core/browser/signin_manager.h b/components/signin/core/browser/signin_manager.h index 2b9717f..25f7920 100644 --- a/components/signin/core/browser/signin_manager.h +++ b/components/signin/core/browser/signin_manager.h
@@ -203,23 +203,6 @@ RemoveAccountsOption remove_option); private: - // Interface that gives information on internal SigninManager operations. Only - // for use by IdentityManager during the conversion of the codebase to use - // //services/identity/public/cpp. - class DiagnosticsClient { - public: - // Sent just before GoogleSigninSucceeded() is fired on observers. - virtual void WillFireGoogleSigninSucceeded( - const AccountInfo& account_info) = 0; - // Sent just before GoogleSignedOut() is fired on observers. - virtual void WillFireGoogleSignedOut(const AccountInfo& account_info) = 0; - }; - - void set_diagnostics_client(DiagnosticsClient* diagnostics_client) { - DCHECK(!diagnostics_client_ || !diagnostics_client); - diagnostics_client_ = diagnostics_client; - } - enum SigninType { SIGNIN_TYPE_NONE, SIGNIN_TYPE_WITH_REFRESH_TOKEN, @@ -305,9 +288,6 @@ // object. SigninClient* client_; - // The DiagnosticsClient object associated with this object. May be null. - DiagnosticsClient* diagnostics_client_; - // The ProfileOAuth2TokenService instance associated with this object. Must // outlive this object. ProfileOAuth2TokenService* token_service_;
diff --git a/components/sync/driver/data_type_controller.h b/components/sync/driver/data_type_controller.h index 815feeb..d148865 100644 --- a/components/sync/driver/data_type_controller.h +++ b/components/sync/driver/data_type_controller.h
@@ -164,7 +164,7 @@ virtual bool ReadyForStart() const; // Returns a ListValue representing all nodes for this data type through - // |callback| on this thread. + // |callback| on this thread. Can only be called if state() != NOT_RUNNING. // Used for populating nodes in Sync Node Browser of chrome://sync-internals. virtual void GetAllNodes(const AllNodesCallback& callback) = 0;
diff --git a/components/sync/engine_impl/model_type_worker.cc b/components/sync/engine_impl/model_type_worker.cc index 5fb7e151..78ff76f1 100644 --- a/components/sync/engine_impl/model_type_worker.cc +++ b/components/sync/engine_impl/model_type_worker.cc
@@ -19,10 +19,14 @@ #include "base/strings/stringprintf.h" #include "base/trace_event/memory_usage_estimator.h" #include "components/sync/base/cancelation_signal.h" +#include "components/sync/base/hash_util.h" +#include "components/sync/base/model_type.h" #include "components/sync/base/time.h" +#include "components/sync/base/unique_position.h" #include "components/sync/engine/model_type_processor.h" #include "components/sync/engine_impl/commit_contribution.h" #include "components/sync/engine_impl/non_blocking_type_commit_contribution.h" +#include "components/sync/engine_impl/syncer_proto_util.h" #include "components/sync/protocol/proto_memory_estimations.h" namespace { @@ -184,7 +188,42 @@ data.non_unique_name = update_entity.name(); data.is_folder = update_entity.folder(); data.parent_id = update_entity.parent_id_string(); - data.unique_position = update_entity.unique_position(); + + // Handle deprecated positioning fields. Relevant only for bookmarks. + // TODO(crbug.com/516866): Add coressponding UMA metrics for each case below. + if (update_entity.has_unique_position()) { + data.unique_position = update_entity.unique_position(); + } else if (update_entity.has_position_in_parent() || + update_entity.has_insert_after_item_id()) { + bool missing_originator_fields = false; + if (!update_entity.has_originator_cache_guid() || + !update_entity.has_originator_client_item_id()) { + DLOG(ERROR) << "Update is missing requirements for bookmark position."; + missing_originator_fields = true; + } + + std::string suffix = + missing_originator_fields + ? UniquePosition::RandomSuffix() + : GenerateSyncableHash( + syncer::GetModelType(update_entity), + /*client_tag=*/update_entity.originator_cache_guid() + + update_entity.originator_client_item_id()); + + if (update_entity.has_originator_cache_guid()) { + data.unique_position = + UniquePosition::FromInt64(update_entity.position_in_parent(), suffix) + .ToProto(); + + } else { + // If update_entity has insert_after_item_id, use 0 index. + data.unique_position = UniquePosition::FromInt64(0, suffix).ToProto(); + } + } else if (SyncerProtoUtil::ShouldMaintainPosition(update_entity) && + !update_entity.deleted()) { + DLOG(ERROR) << "Missing required position information in update."; + } + data.server_defined_unique_tag = update_entity.server_defined_unique_tag(); // Deleted entities must use the default instance of EntitySpecifics in
diff --git a/components/sync/engine_impl/model_type_worker_unittest.cc b/components/sync/engine_impl/model_type_worker_unittest.cc index 6535c0f..e4a9b463 100644 --- a/components/sync/engine_impl/model_type_worker_unittest.cc +++ b/components/sync/engine_impl/model_type_worker_unittest.cc
@@ -15,6 +15,7 @@ #include "components/sync/base/cancelation_signal.h" #include "components/sync/base/fake_encryptor.h" #include "components/sync/base/hash_util.h" +#include "components/sync/base/unique_position.h" #include "components/sync/engine/model_type_processor.h" #include "components/sync/engine_impl/commit_contribution.h" #include "components/sync/engine_impl/cycle/non_blocking_type_debug_info_emitter.h" @@ -1342,7 +1343,9 @@ entity.set_id_string("SomeID"); entity.set_parent_id_string("ParentID"); entity.set_folder(false); - entity.mutable_unique_position()->set_custom_compressed_v1("POSITION"); + entity.mutable_unique_position()->CopyFrom( + UniquePosition::InitialPosition(UniquePosition::RandomSuffix()) + .ToProto()); entity.set_version(1); entity.set_client_defined_unique_tag("CLIENT_TAG"); entity.set_server_defined_unique_tag("SERVER_TAG"); @@ -1360,7 +1363,8 @@ EXPECT_FALSE(data.id.empty()); EXPECT_FALSE(data.parent_id.empty()); EXPECT_FALSE(data.is_folder); - EXPECT_TRUE(data.unique_position.has_custom_compressed_v1()); + EXPECT_TRUE( + syncer::UniquePosition::FromProto(data.unique_position).IsValid()); EXPECT_EQ("CLIENT_TAG", data.client_tag_hash); EXPECT_EQ("SERVER_TAG", data.server_defined_unique_tag); EXPECT_FALSE(data.is_deleted()); @@ -1368,6 +1372,48 @@ EXPECT_EQ(kValue1, data.specifics.preference().value()); } +TEST_F(ModelTypeWorkerTest, PopulateUpdateResponseDataWithPositionInParent) { + InitializeCommitOnly(); + sync_pb::SyncEntity entity; + + entity.set_position_in_parent(5); + entity.set_client_defined_unique_tag("CLIENT_TAG"); + entity.set_server_defined_unique_tag("SERVER_TAG"); + entity.mutable_specifics()->CopyFrom(GenerateSpecifics(kTag1, kValue1)); + + UpdateResponseData response_data; + FakeEncryptor encryptor; + Cryptographer cryptographer(&encryptor); + + EXPECT_EQ(ModelTypeWorker::SUCCESS, + ModelTypeWorker::PopulateUpdateResponseData(&cryptographer, entity, + &response_data)); + const EntityData& data = response_data.entity.value(); + EXPECT_TRUE( + syncer::UniquePosition::FromProto(data.unique_position).IsValid()); +} + +TEST_F(ModelTypeWorkerTest, PopulateUpdateResponseDataWithInsertAfterItemId) { + InitializeCommitOnly(); + sync_pb::SyncEntity entity; + + entity.set_insert_after_item_id("ITEM_ID"); + entity.set_client_defined_unique_tag("CLIENT_TAG"); + entity.set_server_defined_unique_tag("SERVER_TAG"); + entity.mutable_specifics()->CopyFrom(GenerateSpecifics(kTag1, kValue1)); + + UpdateResponseData response_data; + FakeEncryptor encryptor; + Cryptographer cryptographer(&encryptor); + + EXPECT_EQ(ModelTypeWorker::SUCCESS, + ModelTypeWorker::PopulateUpdateResponseData(&cryptographer, entity, + &response_data)); + const EntityData& data = response_data.entity.value(); + EXPECT_TRUE( + syncer::UniquePosition::FromProto(data.unique_position).IsValid()); +} + class GetLocalChangesRequestTest : public testing::Test { public: GetLocalChangesRequestTest();
diff --git a/components/test/data/autofill_assistant/autofill_assistant_target_website_iframe.html b/components/test/data/autofill_assistant/autofill_assistant_target_website_iframe.html index b645ef68..5582a873 100644 --- a/components/test/data/autofill_assistant/autofill_assistant_target_website_iframe.html +++ b/components/test/data/autofill_assistant/autofill_assistant_target_website_iframe.html
@@ -25,6 +25,12 @@ button.parentNode.removeChild(button); } </script> + + <style> + #full_height_section { + height: 100vh; + } + </style> </head> <body onload="createShadowDom()"> @@ -58,5 +64,15 @@ <hr> <div id="shadowsection"></div> + + <!-- + Intentionally make this section has the full height of the window + to force scroll when operating on the elements below not in this + section. + --> + <div id="full_height_section"> + <p>Blank Section + </div> + <div id="focus">Hidden Text</div> </body> -</html> \ No newline at end of file +</html>
diff --git a/components/ui_devtools/BUILD.gn b/components/ui_devtools/BUILD.gn index 4a8e106d..8b09b44 100644 --- a/components/ui_devtools/BUILD.gn +++ b/components/ui_devtools/BUILD.gn
@@ -97,3 +97,35 @@ "//services/network/public/mojom", ] } + +static_library("test_support") { + testonly = true + sources = [ + "ui_devtools_unittest_utils.cc", + "ui_devtools_unittest_utils.h", + ] + public_deps = [ + ":ui_devtools", + "//testing/gmock", + ] +} + +source_set("unit_tests") { + testonly = true + + cflags = [] + if (is_win) { + cflags += [ "/wd4800" ] # Value forced to bool. + } + + sources = [ + "css_agent_unittest.cc", + ] + + deps = [ + ":test_support", + "//testing/gtest", + ] + + configs += [ "//build/config:precompiled_headers" ] +}
diff --git a/components/ui_devtools/css_agent.cc b/components/ui_devtools/css_agent.cc index f0c73b0..22aabcf9 100644 --- a/components/ui_devtools/css_agent.cc +++ b/components/ui_devtools/css_agent.cc
@@ -167,10 +167,10 @@ if (!response.isSuccess()) return response; - updated_styles->addItem(BuildCSSStyle(ui_element)); - if (!SetPropertiesForUIElement(ui_element, updated_bounds, visible)) return NodeNotFoundError(node_id); + + updated_styles->addItem(BuildCSSStyle(ui_element)); } *result = std::move(updated_styles); return Response::OK();
diff --git a/components/ui_devtools/css_agent_unittest.cc b/components/ui_devtools/css_agent_unittest.cc new file mode 100644 index 0000000..ec1d27d3 --- /dev/null +++ b/components/ui_devtools/css_agent_unittest.cc
@@ -0,0 +1,259 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/ui_devtools/css_agent.h" + +#include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" +#include "components/ui_devtools/dom_agent.h" +#include "components/ui_devtools/ui_devtools_unittest_utils.h" +#include "components/ui_devtools/ui_element.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace ui_devtools { + +class FakeUIElement : public UIElement { + public: + FakeUIElement(UIElementDelegate* ui_element_delegate) + : UIElement(UIElementType::ROOT, ui_element_delegate, nullptr) {} + + ~FakeUIElement() override {} + // Return a vector of pairs of properties' names and values. + std::vector<std::pair<std::string, std::string>> GetCustomProperties() + const override { + return {}; + } + void GetBounds(gfx::Rect* bounds) const override { *bounds = bounds_; } + void SetBounds(const gfx::Rect& bounds) override { bounds_ = bounds; } + void GetVisible(bool* visible) const override { *visible = visible_; } + void SetVisible(bool visible) override { visible_ = visible; } + + bool visible() const { return visible_; } + gfx::Rect bounds() const { return bounds_; } + + std::pair<gfx::NativeWindow, gfx::Rect> GetNodeWindowAndBounds() + const override { + return {nullptr, gfx::Rect()}; + } + + std::unique_ptr<protocol::Array<std::string>> GetAttributes() const override { + return protocol::Array<std::string>::create(); + } + + private: + gfx::Rect bounds_; + bool visible_; +}; + +class FakeDOMAgent : public DOMAgent { + public: + void OnUIElementAdded(UIElement* parent, UIElement* child) override { + // nullptr root short circuits everything but adding |child| + // to the node ID map, which is all we need here. + DOMAgent::OnUIElementAdded(nullptr, child); + } + + std::unique_ptr<protocol::DOM::Node> BuildTreeForUIElement( + UIElement* root) override { + return BuildDomNodeFromUIElement(root); + } + + std::vector<UIElement*> CreateChildrenForRoot() override { return {}; } +}; + +class CSSAgentTest : public testing::Test { + public: + void SetUp() override { + testing::Test::SetUp(); + frontend_channel_ = std::make_unique<FakeFrontendChannel>(); + uber_dispatcher_ = + std::make_unique<protocol::UberDispatcher>(frontend_channel_.get()); + dom_agent_ = std::make_unique<FakeDOMAgent>(); + dom_agent_->Init(uber_dispatcher_.get()); + css_agent_ = std::make_unique<CSSAgent>(dom_agent_.get()); + css_agent_->Init(uber_dispatcher_.get()); + css_agent_->enable(); + element_ = std::make_unique<FakeUIElement>(dom_agent_.get()); + dom_agent_->OnUIElementAdded(nullptr, element_.get()); + } + + protected: + using StyleArray = protocol::Array<protocol::CSS::CSSStyle>; + + std::pair<bool, std::unique_ptr<StyleArray>> SetStyle( + const std::string& style_text, + int node_id) { + auto edits = protocol::Array<protocol::CSS::StyleDeclarationEdit>::create(); + auto edit = protocol::CSS::StyleDeclarationEdit::create() + .setStyleSheetId(base::IntToString(node_id)) + .setText(style_text) + .build(); + edits->addItem(std::move(edit)); + std::unique_ptr<StyleArray> output; + auto response = css_agent_->setStyleTexts(std::move(edits), &output); + return {response.isSuccess(), std::move(output)}; + } + + std::string GetValueForProperty(protocol::CSS::CSSStyle* style, + const std::string& property_name) { + auto* properties = style->getCssProperties(); + for (size_t i = 0; i < properties->length(); ++i) { + auto* property = properties->get(i); + if (property->getName() == property_name) { + return property->getValue(); + } + } + return std::string(); + } + int GetStyleSheetChangedCount(int node_id) { + return frontend_channel_->CountProtocolNotificationMessage( + base::StringPrintf("{\"method\":\"CSS.styleSheetChanged\",\"params\":{" + "\"styleSheetId\":\"%d\"}}", + node_id)); + } + + CSSAgent* css_agent() { return css_agent_.get(); } + DOMAgent* dom_agent() { return dom_agent_.get(); } + FakeUIElement* element() { return element_.get(); } + + private: + std::unique_ptr<CSSAgent> css_agent_; + std::unique_ptr<DOMAgent> dom_agent_; + std::unique_ptr<FakeFrontendChannel> frontend_channel_; + std::unique_ptr<protocol::UberDispatcher> uber_dispatcher_; + std::unique_ptr<FakeUIElement> element_; +}; + +TEST_F(CSSAgentTest, UnrecognizedNodeFails) { + EXPECT_FALSE(SetStyle("x : 25", 42).first); +} + +TEST_F(CSSAgentTest, UnrecognizedKeyFails) { + element()->SetVisible(true); + element()->SetBounds(gfx::Rect(1, 2, 3, 4)); + + auto result = SetStyle("nonsense : 3.14", element()->node_id()); + + EXPECT_FALSE(result.first); + EXPECT_FALSE(result.second); + // Ensure element didn't change. + EXPECT_TRUE(element()->visible()); + EXPECT_EQ(element()->bounds(), gfx::Rect(1, 2, 3, 4)); +} + +TEST_F(CSSAgentTest, UnrecognizedValueFails) { + element()->SetVisible(true); + element()->SetBounds(gfx::Rect(1, 2, 3, 4)); + + auto result = SetStyle("visibility : banana", element()->node_id()); + EXPECT_FALSE(result.first); + EXPECT_FALSE(result.second); + // Ensure element didn't change. + EXPECT_TRUE(element()->visible()); + EXPECT_EQ(element()->bounds(), gfx::Rect(1, 2, 3, 4)); +} + +TEST_F(CSSAgentTest, SettingVisibility) { + element()->SetVisible(false); + DCHECK(!element()->visible()); + + auto result = SetStyle("visibility: 1", element()->node_id()); + EXPECT_TRUE(result.first); + EXPECT_TRUE(element()->visible()); + + EXPECT_EQ(result.second->length(), 1U); + protocol::CSS::CSSStyle* style = result.second->get(0); + EXPECT_EQ(style->getStyleSheetId("default"), + base::IntToString(element()->node_id())); + EXPECT_EQ(GetValueForProperty(style, "visibility"), "1"); +} + +TEST_F(CSSAgentTest, SettingX) { + DCHECK_EQ(element()->bounds().x(), 0); + + auto result = SetStyle("x: 500", element()->node_id()); + EXPECT_TRUE(result.first); + EXPECT_EQ(element()->bounds().x(), 500); + EXPECT_EQ(result.second->length(), 1U); + protocol::CSS::CSSStyle* style = result.second->get(0); + EXPECT_EQ(style->getStyleSheetId("default"), + base::IntToString(element()->node_id())); + EXPECT_EQ(GetValueForProperty(style, "x"), "500"); +} + +TEST_F(CSSAgentTest, SettingY) { + DCHECK_EQ(element()->bounds().y(), 0); + + auto result = SetStyle("y: 100", element()->node_id()); + EXPECT_TRUE(result.first); + EXPECT_EQ(element()->bounds().y(), 100); + EXPECT_EQ(result.second->length(), 1U); + protocol::CSS::CSSStyle* style = result.second->get(0); + EXPECT_EQ(style->getStyleSheetId("default"), + base::IntToString(element()->node_id())); + EXPECT_EQ(GetValueForProperty(style, "y"), "100"); +} +TEST_F(CSSAgentTest, SettingWidth) { + DCHECK_EQ(element()->bounds().width(), 0); + + auto result = SetStyle("width: 20", element()->node_id()); + EXPECT_TRUE(result.first); + EXPECT_EQ(element()->bounds().width(), 20); + EXPECT_EQ(result.second->length(), 1U); + protocol::CSS::CSSStyle* style = result.second->get(0); + EXPECT_EQ(style->getStyleSheetId("default"), + base::IntToString(element()->node_id())); + EXPECT_EQ(GetValueForProperty(style, "width"), "20"); +} +TEST_F(CSSAgentTest, SettingHeight) { + DCHECK_EQ(element()->bounds().height(), 0); + + auto result = SetStyle("height: 30", element()->node_id()); + EXPECT_TRUE(result.first); + EXPECT_EQ(element()->bounds().height(), 30); + EXPECT_EQ(result.second->length(), 1U); + protocol::CSS::CSSStyle* style = result.second->get(0); + EXPECT_EQ(style->getStyleSheetId("default"), + base::IntToString(element()->node_id())); + EXPECT_EQ(GetValueForProperty(style, "height"), "30"); +} + +TEST_F(CSSAgentTest, SettingAll) { + DCHECK(element()->bounds() == gfx::Rect()); + DCHECK(element()->visible()); + + // Throw in odd whitespace while we're at it. + std::string new_text( + "\ny: 25; width: 50; visibility:0; height: 30;\nx: 9000;\n\n"); + auto result = SetStyle(new_text, element()->node_id()); + EXPECT_TRUE(result.first); + EXPECT_EQ(element()->bounds(), gfx::Rect(9000, 25, 50, 30)); + EXPECT_FALSE(element()->visible()); + EXPECT_EQ(result.second->length(), 1U); + protocol::CSS::CSSStyle* style = result.second->get(0); + EXPECT_EQ(style->getStyleSheetId("default"), + base::IntToString(element()->node_id())); + EXPECT_EQ(GetValueForProperty(style, "x"), "9000"); + EXPECT_EQ(GetValueForProperty(style, "y"), "25"); + EXPECT_EQ(GetValueForProperty(style, "width"), "50"); + EXPECT_EQ(GetValueForProperty(style, "height"), "30"); + EXPECT_EQ(GetValueForProperty(style, "visibility"), "0"); +} + +TEST_F(CSSAgentTest, UpdateOnBoundsChange) { + FakeUIElement another_element(dom_agent()); + EXPECT_EQ(0, GetStyleSheetChangedCount(element()->node_id())); + EXPECT_EQ(0, GetStyleSheetChangedCount(another_element.node_id())); + css_agent()->OnElementBoundsChanged(element()); + EXPECT_EQ(1, GetStyleSheetChangedCount(element()->node_id())); + EXPECT_EQ(0, GetStyleSheetChangedCount(another_element.node_id())); + css_agent()->OnElementBoundsChanged(&another_element); + EXPECT_EQ(1, GetStyleSheetChangedCount(element()->node_id())); + EXPECT_EQ(1, GetStyleSheetChangedCount(another_element.node_id())); + + css_agent()->OnElementBoundsChanged(&another_element); + EXPECT_EQ(1, GetStyleSheetChangedCount(element()->node_id())); + EXPECT_EQ(2, GetStyleSheetChangedCount(another_element.node_id())); +} +} // namespace ui_devtools
diff --git a/components/ui_devtools/ui_devtools_unittest_utils.cc b/components/ui_devtools/ui_devtools_unittest_utils.cc new file mode 100644 index 0000000..ba655e24 --- /dev/null +++ b/components/ui_devtools/ui_devtools_unittest_utils.cc
@@ -0,0 +1,37 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/ui_devtools/ui_devtools_unittest_utils.h" + +#include "base/strings/string_util.h" + +namespace ui_devtools { + +MockUIElementDelegate::MockUIElementDelegate() {} +MockUIElementDelegate::~MockUIElementDelegate() {} + +FakeFrontendChannel::FakeFrontendChannel() {} +FakeFrontendChannel::~FakeFrontendChannel() {} + +int FakeFrontendChannel::CountProtocolNotificationMessageStartsWith( + const std::string& message) { + int count = 0; + for (const std::string& s : protocol_notification_messages_) { + if (base::StartsWith(s, message, base::CompareCase::SENSITIVE)) + count++; + } + return count; +} +int FakeFrontendChannel::CountProtocolNotificationMessage( + const std::string& message) { + return std::count(protocol_notification_messages_.begin(), + protocol_notification_messages_.end(), message); +} + +void FakeFrontendChannel::sendProtocolNotification( + std::unique_ptr<protocol::Serializable> message) { + protocol_notification_messages_.push_back(message->serialize()); +} + +} // namespace ui_devtools
diff --git a/components/ui_devtools/ui_devtools_unittest_utils.h b/components/ui_devtools/ui_devtools_unittest_utils.h new file mode 100644 index 0000000..544e38ba --- /dev/null +++ b/components/ui_devtools/ui_devtools_unittest_utils.h
@@ -0,0 +1,53 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_UI_DEVTOOLS_UI_DEVTOOLS_UNITTEST_UTILS_H_ +#define COMPONENTS_UI_DEVTOOLS_UI_DEVTOOLS_UNITTEST_UTILS_H_ + +#include "components/ui_devtools/Protocol.h" +#include "components/ui_devtools/ui_element_delegate.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace ui_devtools { + +class FakeFrontendChannel : public protocol::FrontendChannel { + public: + FakeFrontendChannel(); + ~FakeFrontendChannel() override; + + int CountProtocolNotificationMessageStartsWith(const std::string& message); + + int CountProtocolNotificationMessage(const std::string& message); + + // FrontendChannel: + void sendProtocolResponse( + int callId, + std::unique_ptr<protocol::Serializable> message) override {} + void flushProtocolNotifications() override {} + void fallThrough(int call_id, + const std::string& method, + const std::string& message) override {} + void sendProtocolNotification( + std::unique_ptr<protocol::Serializable> message) override; + + private: + std::vector<std::string> protocol_notification_messages_; + + DISALLOW_COPY_AND_ASSIGN(FakeFrontendChannel); +}; + +class MockUIElementDelegate : public UIElementDelegate { + public: + MockUIElementDelegate(); + ~MockUIElementDelegate() override; + + MOCK_METHOD2(OnUIElementAdded, void(UIElement*, UIElement*)); + MOCK_METHOD2(OnUIElementReordered, void(UIElement*, UIElement*)); + MOCK_METHOD1(OnUIElementRemoved, void(UIElement*)); + MOCK_METHOD1(OnUIElementBoundsChanged, void(UIElement*)); +}; + +} // namespace ui_devtools + +#endif // COMPONENTS_UI_DEVTOOLS_UI_DEVTOOLS_UNITTEST_UTILS_H_
diff --git a/components/ui_devtools/views/BUILD.gn b/components/ui_devtools/views/BUILD.gn index 9937faf8..7aa5347 100644 --- a/components/ui_devtools/views/BUILD.gn +++ b/components/ui_devtools/views/BUILD.gn
@@ -42,11 +42,15 @@ sources = [ "ui_devtools_unittest.cc", + "view_element_unittest.cc", + "widget_element_unittest.cc", + "window_element_unittest.cc", ] deps = [ ":views", "//components/ui_devtools", + "//components/ui_devtools:test_support", "//skia", "//testing/gtest", "//ui/aura",
diff --git a/components/ui_devtools/views/ui_devtools_unittest.cc b/components/ui_devtools/views/ui_devtools_unittest.cc index 1fcd1a6..cf1a597 100644 --- a/components/ui_devtools/views/ui_devtools_unittest.cc +++ b/components/ui_devtools/views/ui_devtools_unittest.cc
@@ -7,6 +7,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "components/ui_devtools/css_agent.h" +#include "components/ui_devtools/ui_devtools_unittest_utils.h" #include "components/ui_devtools/ui_element.h" #include "components/ui_devtools/views/dom_agent_aura.h" #include "components/ui_devtools/views/overlay_agent_aura.h" @@ -45,43 +46,6 @@ DISALLOW_COPY_AND_ASSIGN(TestView); }; -class FakeFrontendChannel : public FrontendChannel { - public: - FakeFrontendChannel() {} - ~FakeFrontendChannel() override {} - - int CountProtocolNotificationMessageStartsWith(const std::string& message) { - int count = 0; - for (const std::string& s : protocol_notification_messages_) { - if (base::StartsWith(s, message, base::CompareCase::SENSITIVE)) - count++; - } - return count; - } - - int CountProtocolNotificationMessage(const std::string& message) { - return std::count(protocol_notification_messages_.begin(), - protocol_notification_messages_.end(), message); - } - - // FrontendChannel: - void sendProtocolResponse(int callId, - std::unique_ptr<Serializable> message) override {} - void flushProtocolNotifications() override {} - void fallThrough(int call_id, - const std::string& method, - const std::string& message) override {} - void sendProtocolNotification( - std::unique_ptr<Serializable> message) override { - protocol_notification_messages_.push_back(message->serialize()); - } - - private: - std::vector<std::string> protocol_notification_messages_; - - DISALLOW_COPY_AND_ASSIGN(FakeFrontendChannel); -}; - std::string GetAttributeValue(const std::string& attribute, DOM::Node* node) { EXPECT_TRUE(node->hasAttributes()); Array<std::string>* attributes = node->getAttributes(nullptr); @@ -133,31 +97,6 @@ return window_node; } -int GetIntPropertyByName(const std::string& name, - Array<CSS::CSSProperty>* properties) { - for (size_t i = 0; i < properties->length(); i++) { - CSS::CSSProperty* property = properties->get(i); - if (property->getName() == name) { - int value; - EXPECT_TRUE(base::StringToInt(property->getValue(), &value)); - return value; - } - } - NOTREACHED(); - return -1; -} - -std::string GetStringPropertyByName(const std::string& name, - Array<CSS::CSSProperty>* properties) { - for (size_t i = 0; i < properties->length(); i++) { - CSS::CSSProperty* property = properties->get(i); - if (property->getName() == name) - return property->getValue(); - } - NOTREACHED(); - return nullptr; -} - ui::Layer* GetHighlightingLayer(aura::Window* root_window) { for (auto* layer : root_window->layer()->children()) { if (layer->name() == "HighlightingLayer") @@ -275,13 +214,6 @@ parent_id, node_id))); } - int GetStyleSheetChangedCount(int node_id) { - return frontend_channel()->CountProtocolNotificationMessage( - base::StringPrintf("{\"method\":\"CSS.styleSheetChanged\",\"params\":{" - "\"styleSheetId\":\"%d\"}}", - node_id)); - } - int GetOverlayNodeHighlightRequestedCount(int node_id) { return frontend_channel()->CountProtocolNotificationMessage( base::StringPrintf( @@ -298,49 +230,6 @@ node_id)); } - void CompareNodeBounds(DOM::Node* node, const gfx::Rect& bounds) { - Maybe<CSS::CSSStyle> styles; - css_agent_->getMatchedStylesForNode(node->getNodeId(), &styles); - ASSERT_TRUE(styles.isJust()); - Array<CSS::CSSProperty>* properties = styles.fromJust()->getCssProperties(); - EXPECT_EQ(bounds.height(), GetIntPropertyByName("height", properties)); - EXPECT_EQ(bounds.width(), GetIntPropertyByName("width", properties)); - EXPECT_EQ(bounds.x(), GetIntPropertyByName("x", properties)); - EXPECT_EQ(bounds.y(), GetIntPropertyByName("y", properties)); - } - - void CompareViewAtrributes(DOM::Node* node, views::View* view) { - Maybe<CSS::CSSStyle> styles; - css_agent_->getMatchedStylesForNode(node->getNodeId(), &styles); - ASSERT_TRUE(styles.isJust()); - Array<CSS::CSSProperty>* properties = styles.fromJust()->getCssProperties(); - - base::string16 description; - if (view->GetTooltipText(gfx::Point(), &description)) { - EXPECT_EQ(base::UTF16ToUTF8(description), - GetStringPropertyByName("tooltip", properties)); - } - } - - void SetStyleTexts(DOM::Node* node, - const std::string& style_text, - bool success) { - auto edits = Array<CSS::StyleDeclarationEdit>::create(); - auto edit = CSS::StyleDeclarationEdit::create() - .setStyleSheetId(base::IntToString(node->getNodeId())) - .setText(style_text) - .build(); - edits->addItem(std::move(edit)); - std::unique_ptr<Array<CSS::CSSStyle>> output; - EXPECT_EQ(success, - css_agent_->setStyleTexts(std::move(edits), &output).isSuccess()); - - if (success) - ASSERT_TRUE(output); - else - ASSERT_FALSE(output); - } - void HighlightNode(int node_id) { overlay_agent_->highlightNode( CreateHighlightConfig(kBackgroundColor, kBorderColor), node_id); @@ -1182,134 +1071,4 @@ // TODO(thanhph): Make test AshDevToolsTest.MultipleDisplayHighlight work with // multiple displays. https://crbug.com/726831. -TEST_F(UIDevToolsTest, WindowWidgetViewGetMatchedStylesForNode) { - std::unique_ptr<views::Widget> widget( - CreateTestWidget(gfx::Rect(1, 1, 1, 1))); - aura::Window* parent_window = widget->GetNativeWindow(); - std::unique_ptr<aura::Window> window(CreateChildWindow(parent_window)); - gfx::Rect window_bounds(2, 2, 3, 3); - gfx::Rect widget_bounds(50, 50, 100, 75); - gfx::Rect view_bounds(4, 4, 3, 3); - window->SetBounds(window_bounds); - widget->SetBounds(widget_bounds); - widget->GetRootView()->SetBoundsRect(view_bounds); - - std::unique_ptr<DOM::Node> root; - dom_agent()->getDocument(&root); - - DOM::Node* parent_node = FindInRoot(parent_window, root.get()); - ASSERT_TRUE(parent_node); - Array<DOM::Node>* parent_children = parent_node->getChildren(nullptr); - ASSERT_TRUE(parent_children); - - CompareNodeBounds(parent_node, widget_bounds); - CompareNodeBounds(parent_children->get(1), window_bounds); - CompareNodeBounds(parent_children->get(0)->getChildren(nullptr)->get(0), - view_bounds); - CompareViewAtrributes(parent_children->get(0)->getChildren(nullptr)->get(0), - widget->GetRootView()); -} - -TEST_F(UIDevToolsTest, WindowWidgetViewStyleSheetChanged) { - std::unique_ptr<views::Widget> widget( - CreateTestWidget(gfx::Rect(1, 1, 1, 1))); - aura::Window* widget_window = widget->GetNativeWindow(); - std::unique_ptr<aura::Window> child(CreateChildWindow(widget_window)); - - std::unique_ptr<DOM::Node> root; - dom_agent()->getDocument(&root); - - gfx::Rect child_bounds(2, 2, 3, 3); - gfx::Rect widget_bounds(10, 10, 150, 160); - gfx::Rect view_bounds(4, 4, 3, 3); - child->SetBounds(child_bounds); - widget->SetBounds(widget_bounds); - widget->GetRootView()->SetBoundsRect(view_bounds); - - DOM::Node* widget_node = FindInRoot(widget_window, root.get()); - ASSERT_TRUE(widget_node); - Array<DOM::Node>* widget_node_children = widget_node->getChildren(nullptr); - ASSERT_TRUE(widget_node_children); - - EXPECT_EQ(1, GetStyleSheetChangedCount(widget_node->getNodeId())); - EXPECT_EQ( - 1, GetStyleSheetChangedCount(widget_node_children->get(1)->getNodeId())); - EXPECT_EQ(2, GetStyleSheetChangedCount(widget_node_children->get(0) - ->getChildren(nullptr) - ->get(0) - ->getNodeId())); -} - -TEST_F(UIDevToolsTest, WindowWidgetViewSetStyleText) { - std::unique_ptr<views::Widget> widget( - CreateTestWidget(gfx::Rect(0, 0, 400, 400))); - aura::Window* parent_window = widget->GetNativeWindow(); - std::unique_ptr<aura::Window> window(CreateChildWindow(parent_window)); - views::View* root_view = widget->GetRootView(); - - std::unique_ptr<DOM::Node> root; - dom_agent()->getDocument(&root); - - DOM::Node* parent_node = FindInRoot(parent_window, root.get()); - ASSERT_TRUE(parent_node); - Array<DOM::Node>* parent_children = parent_node->getChildren(nullptr); - ASSERT_TRUE(parent_children); - - // Test different combinations on window node - DOM::Node* window_node = parent_children->get(1); - - SetStyleTexts(window_node, - "x: 25; y:35; width: 5; height: 20; visibility: 1;", true); - EXPECT_EQ(gfx::Rect(25, 35, 5, 20), window->bounds()); - EXPECT_TRUE(window->IsVisible()); - - SetStyleTexts(window_node, "test_nothing_happens:1;", false); - EXPECT_EQ(gfx::Rect(25, 35, 5, 20), window->bounds()); // Not changed - - SetStyleTexts(window_node, "\nheight: 10;\nvisibility: 0;\n", true); - EXPECT_EQ(gfx::Rect(25, 35, 5, 10), window->bounds()); - EXPECT_FALSE(window->IsVisible()); - - SetStyleTexts(window_node, "\nx: 10; y: 23; width: 52;\n ", true); - EXPECT_EQ(gfx::Rect(10, 23, 52, 10), window->bounds()); - - // Test different combinations on widget node - DOM::Node* widget_node = parent_children->get(0); - - SetStyleTexts(widget_node, - "x: 25; y:35; width: 53; height: 64; visibility: 0;", true); - EXPECT_EQ(gfx::Rect(25, 35, 53, 64), widget->GetRestoredBounds()); - EXPECT_FALSE(widget->IsVisible()); - - SetStyleTexts(widget_node, "test_nothing_happens:1;", false); - EXPECT_EQ(gfx::Rect(25, 35, 53, 64), - widget->GetRestoredBounds()); // Not changed - - SetStyleTexts(widget_node, "\nheight: 123;\nvisibility: 1;\n", true); - EXPECT_EQ(gfx::Rect(25, 35, 53, 123), widget->GetRestoredBounds()); - EXPECT_TRUE(widget->IsVisible()); - - SetStyleTexts(widget_node, "\nx: 10; y: 23; width: 98;\n ", true); - EXPECT_EQ(gfx::Rect(10, 23, 98, 123), widget->GetRestoredBounds()); - - // Test different combinations on view node - DOM::Node* root_view_node = widget_node->getChildren(nullptr)->get(0); - - SetStyleTexts(root_view_node, - "x: 25; y:35; width: 45; height: 20; visibility: 0;", true); - EXPECT_EQ(gfx::Rect(25, 35, 45, 20), root_view->bounds()); - EXPECT_FALSE(root_view->visible()); - - SetStyleTexts(root_view_node, "test_nothing_happens:1;", false); - EXPECT_EQ(gfx::Rect(25, 35, 45, 20), root_view->bounds()); // Not changed - - SetStyleTexts(root_view_node, "\nheight: 73;\n ", true); - EXPECT_EQ(gfx::Rect(25, 35, 45, 73), root_view->bounds()); - - SetStyleTexts(root_view_node, "\nx: 10; y: 23; width: 52;\nvisibility: 1;\n", - true); - EXPECT_EQ(gfx::Rect(10, 23, 52, 73), root_view->bounds()); - EXPECT_TRUE(root_view->visible()); -} - } // namespace ui_devtools
diff --git a/components/ui_devtools/views/view_element_unittest.cc b/components/ui_devtools/views/view_element_unittest.cc new file mode 100644 index 0000000..3abc018 --- /dev/null +++ b/components/ui_devtools/views/view_element_unittest.cc
@@ -0,0 +1,131 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/ui_devtools/views/view_element.h" + +#include "base/strings/utf_string_conversions.h" +#include "components/ui_devtools/Protocol.h" +#include "components/ui_devtools/ui_devtools_unittest_utils.h" +#include "ui/views/test/views_test_base.h" + +namespace ui_devtools { + +using ::testing::_; + +class NamedTestView : public views::View { + public: + static const char kViewClassName[]; + const char* GetClassName() const override { return kViewClassName; } + + // For custom properties test. + bool GetTooltipText(const gfx::Point& p, + base::string16* tooltip) const override { + *tooltip = base::ASCIIToUTF16("This is the tooltip"); + return true; + } +}; +const char NamedTestView::kViewClassName[] = "NamedTestView"; + +class ViewElementTest : public views::ViewsTestBase { + public: + ViewElementTest() {} + ~ViewElementTest() override {} + + protected: + void SetUp() override { + views::ViewsTestBase::SetUp(); + view_.reset(new NamedTestView); + delegate_.reset(new testing::NiceMock<MockUIElementDelegate>); + // |OnUIElementAdded| is called on element creation. + EXPECT_CALL(*delegate_, OnUIElementAdded(_, _)).Times(1); + element_.reset(new ViewElement(view_.get(), delegate_.get(), nullptr)); + } + + NamedTestView* view() { return view_.get(); } + ViewElement* element() { return element_.get(); } + MockUIElementDelegate* delegate() { return delegate_.get(); } + + private: + std::unique_ptr<NamedTestView> view_; + std::unique_ptr<ViewElement> element_; + std::unique_ptr<MockUIElementDelegate> delegate_; + + DISALLOW_COPY_AND_ASSIGN(ViewElementTest); +}; + +TEST_F(ViewElementTest, SettingsBoundsOnViewCallsDelegate) { + EXPECT_CALL(*delegate(), OnUIElementBoundsChanged(element())).Times(1); + view()->SetBounds(1, 2, 3, 4); +} + +TEST_F(ViewElementTest, AddingChildView) { + // The first call is from the element being created, before it + // gets parented to |element_|. + EXPECT_CALL(*delegate(), OnUIElementAdded(nullptr, _)).Times(1); + EXPECT_CALL(*delegate(), OnUIElementAdded(element(), _)).Times(1); + views::View child_view; + view()->AddChildView(&child_view); + + DCHECK_EQ(element()->children().size(), 1U); + UIElement* child_element = element()->children()[0]; + + EXPECT_CALL(*delegate(), OnUIElementRemoved(child_element)).Times(1); + view()->RemoveChildView(&child_view); +} + +TEST_F(ViewElementTest, SettingsBoundsOnElementSetsOnView) { + DCHECK(view()->bounds() == gfx::Rect()); + + element()->SetBounds(gfx::Rect(1, 2, 3, 4)); + EXPECT_EQ(view()->bounds(), gfx::Rect(1, 2, 3, 4)); +} + +TEST_F(ViewElementTest, SettingVisibleOnElementSetsOnView) { + DCHECK(view()->visible()); + + element()->SetVisible(false); + EXPECT_FALSE(view()->visible()); + + element()->SetVisible(true); + EXPECT_TRUE(view()->visible()); +} + +TEST_F(ViewElementTest, GetVisible) { + bool visible; + + view()->SetVisible(false); + element()->GetVisible(&visible); + EXPECT_FALSE(visible); + + view()->SetVisible(true); + element()->GetVisible(&visible); + EXPECT_TRUE(visible); +} + +TEST_F(ViewElementTest, GetBounds) { + gfx::Rect bounds; + + view()->SetBounds(10, 20, 30, 40); + element()->GetBounds(&bounds); + EXPECT_EQ(bounds, gfx::Rect(10, 20, 30, 40)); +} + +TEST_F(ViewElementTest, GetAttributes) { + std::unique_ptr<protocol::Array<std::string>> attrs = + element()->GetAttributes(); + DCHECK_EQ(attrs->length(), 2U); + + EXPECT_EQ(attrs->get(0), "name"); + EXPECT_EQ(attrs->get(1), NamedTestView::kViewClassName); +} + +TEST_F(ViewElementTest, GetCustomProperties) { + auto props = element()->GetCustomProperties(); + DCHECK_EQ(props.size(), 1U); + + EXPECT_EQ(props[0].first, "tooltip"); + EXPECT_EQ(props[0].second, "This is the tooltip"); +} + +} // namespace ui_devtools
diff --git a/components/ui_devtools/views/widget_element.cc b/components/ui_devtools/views/widget_element.cc index c354cc2..1ee7b26a 100644 --- a/components/ui_devtools/views/widget_element.cc +++ b/components/ui_devtools/views/widget_element.cc
@@ -15,10 +15,14 @@ : UIElement(UIElementType::WIDGET, ui_element_delegate, parent), widget_(widget) { widget_->AddRemovalsObserver(this); + widget_->AddObserver(this); } WidgetElement::~WidgetElement() { - widget_->RemoveRemovalsObserver(this); + if (widget_) { + widget_->RemoveRemovalsObserver(this); + widget_->RemoveObserver(this); + } } void WidgetElement::OnWillRemoveView(views::Widget* widget, views::View* view) { @@ -36,6 +40,12 @@ delegate()->OnUIElementBoundsChanged(this); } +void WidgetElement::OnWidgetDestroyed(views::Widget* widget) { + DCHECK_EQ(widget, widget_); + delegate()->OnUIElementRemoved(this); + widget_ = nullptr; +} + std::vector<std::pair<std::string, std::string>> WidgetElement::GetCustomProperties() const { return {};
diff --git a/components/ui_devtools/views/widget_element.h b/components/ui_devtools/views/widget_element.h index 571c0f6..51c4d271 100644 --- a/components/ui_devtools/views/widget_element.h +++ b/components/ui_devtools/views/widget_element.h
@@ -33,6 +33,7 @@ // views::WidgetObserver: void OnWidgetBoundsChanged(views::Widget* widget, const gfx::Rect& new_bounds) override; + void OnWidgetDestroyed(views::Widget* widget) override; // UIElement: std::vector<std::pair<std::string, std::string>> GetCustomProperties()
diff --git a/components/ui_devtools/views/widget_element_unittest.cc b/components/ui_devtools/views/widget_element_unittest.cc new file mode 100644 index 0000000..d598dbb --- /dev/null +++ b/components/ui_devtools/views/widget_element_unittest.cc
@@ -0,0 +1,133 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/ui_devtools/views/widget_element.h" + +#include "components/ui_devtools/Protocol.h" +#include "components/ui_devtools/ui_devtools_unittest_utils.h" +#include "components/ui_devtools/views/view_element.h" +#include "ui/views/test/views_test_base.h" + +namespace ui_devtools { + +using ::testing::_; + +namespace { +const std::string kWidgetName = "A test widget"; +} + +class WidgetElementTest : public views::ViewsTestBase { + public: + WidgetElementTest() {} + ~WidgetElementTest() override {} + + void SetUp() override { + views::ViewsTestBase::SetUp(); + + widget_ = new views::Widget; + views::Widget::InitParams params = + CreateParams(views::Widget::InitParams::TYPE_WINDOW); + params.name = kWidgetName; + widget_->Init(params); + + delegate_.reset(new testing::NiceMock<MockUIElementDelegate>); + element_.reset(new WidgetElement(widget_, delegate_.get(), nullptr)); + // The widget element will delete the ViewElement in |OnWillRemoveView| + // TODO(lgrey): I think probably WidgetElement should do this itself + // rather than making the DOMAgent (or test) put the tree together. + element()->AddChild( + new ViewElement(widget_->GetRootView(), delegate_.get(), element())); + } + + void TearDown() override { + widget_->CloseNow(); + views::ViewsTestBase::TearDown(); + } + + protected: + views::Widget* widget() { return widget_; }; + WidgetElement* element() { return element_.get(); } + MockUIElementDelegate* delegate() { return delegate_.get(); } + + private: + views::Widget* widget_ = nullptr; + std::unique_ptr<WidgetElement> element_; + std::unique_ptr<MockUIElementDelegate> delegate_; + + DISALLOW_COPY_AND_ASSIGN(WidgetElementTest); +}; +TEST_F(WidgetElementTest, SettingsBoundsOnWidgetCallsDelegate) { + // Once for the root view, and once for the widget. + EXPECT_CALL(*delegate(), OnUIElementBoundsChanged(_)) + .Times(::testing::AtLeast(1)); + EXPECT_CALL(*delegate(), OnUIElementBoundsChanged(element())) + .Times(::testing::AtLeast(1)); + widget()->SetBounds(gfx::Rect(10, 20, 300, 400)); +} + +TEST_F(WidgetElementTest, SettingsBoundsOnElementSetsOnWidget) { + gfx::Rect old_bounds = widget()->GetRestoredBounds(); + gfx::Rect new_bounds = gfx::Rect(10, 20, 300, 400); + DCHECK(old_bounds != new_bounds); + + element()->SetBounds(new_bounds); + EXPECT_EQ(widget()->GetRestoredBounds(), new_bounds); +} + +TEST_F(WidgetElementTest, SettingVisibleOnElementSetsOnWidget) { + DCHECK(!widget()->IsVisible()); + + element()->SetVisible(true); + EXPECT_TRUE(widget()->IsVisible()); + + element()->SetVisible(false); + EXPECT_FALSE(widget()->IsVisible()); +} + +TEST_F(WidgetElementTest, GetBounds) { + gfx::Rect actual_bounds; + + gfx::Rect new_bounds = gfx::Rect(10, 20, 300, 400); + widget()->SetBounds(new_bounds); + element()->GetBounds(&actual_bounds); + EXPECT_EQ(actual_bounds, new_bounds); +} + +TEST_F(WidgetElementTest, GetVisible) { + DCHECK(!widget()->IsVisible()); + bool visible; + + element()->GetVisible(&visible); + EXPECT_FALSE(visible); + + widget()->Show(); + element()->GetVisible(&visible); + EXPECT_TRUE(visible); + + widget()->Hide(); + element()->GetVisible(&visible); + EXPECT_FALSE(visible); +} + +TEST_F(WidgetElementTest, GetAttributes) { + std::unique_ptr<protocol::Array<std::string>> attrs = + element()->GetAttributes(); + + DCHECK_EQ(attrs->length(), 4U); + + EXPECT_EQ(attrs->get(0), "name"); + EXPECT_EQ(attrs->get(1), kWidgetName); + + DCHECK(!widget()->IsActive()); + EXPECT_EQ(attrs->get(2), "active"); + EXPECT_EQ(attrs->get(3), "false"); + + widget()->Activate(); + attrs = element()->GetAttributes(); + DCHECK_EQ(attrs->length(), 4U); + EXPECT_EQ(attrs->get(2), "active"); + EXPECT_EQ(attrs->get(3), "true"); +} + +} // namespace ui_devtools
diff --git a/components/ui_devtools/views/window_element_unittest.cc b/components/ui_devtools/views/window_element_unittest.cc new file mode 100644 index 0000000..bada0b542 --- /dev/null +++ b/components/ui_devtools/views/window_element_unittest.cc
@@ -0,0 +1,124 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/ui_devtools/views/window_element.h" + +#include "components/ui_devtools/Protocol.h" +#include "components/ui_devtools/ui_devtools_unittest_utils.h" +#include "ui/aura/window.h" +#include "ui/views/test/views_test_base.h" +#include "ui/wm/core/window_util.h" + +namespace ui_devtools { +using ::testing::_; + +class WindowElementTest : public views::ViewsTestBase { + public: + WindowElementTest() {} + ~WindowElementTest() override {} + + void SetUp() override { + views::ViewsTestBase::SetUp(); + + window_.reset(new aura::Window(nullptr, aura::client::WINDOW_TYPE_NORMAL)); + window_->Init(ui::LAYER_NOT_DRAWN); + aura::Window* root_window = GetContext(); + DCHECK(root_window); + root_window->AddChild(window_.get()); + delegate_.reset(new testing::NiceMock<MockUIElementDelegate>); + // |OnUIElementAdded| is called on element creation. + EXPECT_CALL(*delegate_, OnUIElementAdded(_, _)).Times(1); + element_.reset(new WindowElement(window_.get(), delegate_.get(), nullptr)); + } + + void TearDown() override { + // The root window needs to be empty by teardown. + element_.reset(); + delegate_.reset(); + window_.reset(); + views::ViewsTestBase::TearDown(); + } + + protected: + aura::Window* window() { return window_.get(); } + WindowElement* element() { return element_.get(); } + MockUIElementDelegate* delegate() { return delegate_.get(); } + + private: + std::unique_ptr<aura::Window> window_; + std::unique_ptr<WindowElement> element_; + std::unique_ptr<MockUIElementDelegate> delegate_; + + DISALLOW_COPY_AND_ASSIGN(WindowElementTest); +}; + +TEST_F(WindowElementTest, SettingsBoundsOnWindowCallsDelegate) { + EXPECT_CALL(*delegate(), OnUIElementBoundsChanged(element())).Times(1); + window()->SetBounds(gfx::Rect(10, 20, 300, 400)); +} + +TEST_F(WindowElementTest, SettingsBoundsOnElementSetsOnWindow) { + gfx::Rect old_bounds = window()->bounds(); + + gfx::Rect new_bounds = gfx::Rect(10, 20, 300, 400); + DCHECK(old_bounds != new_bounds); + + element()->SetBounds(new_bounds); + EXPECT_EQ(window()->bounds(), new_bounds); +} + +TEST_F(WindowElementTest, SettingVisibleOnElementSetsOnWindow) { + DCHECK(!window()->IsVisible()); + + element()->SetVisible(true); + EXPECT_TRUE(window()->IsVisible()); + + element()->SetVisible(false); + EXPECT_FALSE(window()->IsVisible()); +} + +TEST_F(WindowElementTest, GetVisible) { + bool visible; + + window()->Hide(); + element()->GetVisible(&visible); + EXPECT_FALSE(visible); + + window()->Show(); + element()->GetVisible(&visible); + EXPECT_TRUE(visible); +} + +TEST_F(WindowElementTest, GetBounds) { + gfx::Rect actual_bounds; + + gfx::Rect new_bounds = gfx::Rect(10, 20, 300, 400); + window()->SetBounds(new_bounds); + element()->GetBounds(&actual_bounds); + EXPECT_EQ(actual_bounds, new_bounds); +} + +TEST_F(WindowElementTest, GetAttributes) { + std::string window_name("A window name"); + window()->SetName(window_name); + + std::unique_ptr<protocol::Array<std::string>> attrs = + element()->GetAttributes(); + + DCHECK_EQ(attrs->length(), 4U); + + EXPECT_EQ(attrs->get(0), "name"); + EXPECT_EQ(attrs->get(1), window_name); + + DCHECK(!wm::IsActiveWindow(window())); + EXPECT_EQ(attrs->get(2), "active"); + EXPECT_EQ(attrs->get(3), "false"); + + wm::ActivateWindow(window()); + attrs = element()->GetAttributes(); + DCHECK_EQ(attrs->length(), 4U); + EXPECT_EQ(attrs->get(2), "active"); + EXPECT_EQ(attrs->get(3), "true"); +} +} // namespace ui_devtools
diff --git a/components/viz/common/gl_scaler_unittest.cc b/components/viz/common/gl_scaler_unittest.cc index 7c16530..ed70215 100644 --- a/components/viz/common/gl_scaler_unittest.cc +++ b/components/viz/common/gl_scaler_unittest.cc
@@ -69,6 +69,10 @@ NOTREACHED(); return nullptr; } + gpu::SharedImageInterface* SharedImageInterface() final { + NOTREACHED(); + return nullptr; + } const gpu::GpuFeatureInfo& GetGpuFeatureInfo() const final { NOTREACHED(); return *reinterpret_cast<gpu::GpuFeatureInfo*>(0xdeadbeef);
diff --git a/components/viz/common/gpu/context_provider.h b/components/viz/common/gpu/context_provider.h index c00e9ff..70c1ed5 100644 --- a/components/viz/common/gpu/context_provider.h +++ b/components/viz/common/gpu/context_provider.h
@@ -26,6 +26,7 @@ namespace gpu { class ContextSupport; struct GpuFeatureInfo; +class SharedImageInterface; namespace gles2 { class GLES2Interface; @@ -92,6 +93,8 @@ // nullptr if a GrContext fails to initialize on this context. virtual class GrContext* GrContext() = 0; + virtual gpu::SharedImageInterface* SharedImageInterface() = 0; + // Returns the capabilities of the currently bound 3d context. The context // provider must have been successfully bound to a thread before calling this. virtual const gpu::Capabilities& ContextCapabilities() const = 0;
diff --git a/components/viz/common/gpu/raster_context_provider.h b/components/viz/common/gpu/raster_context_provider.h index d4c7953..7aeacdd3 100644 --- a/components/viz/common/gpu/raster_context_provider.h +++ b/components/viz/common/gpu/raster_context_provider.h
@@ -26,6 +26,7 @@ namespace gpu { class ContextSupport; struct GpuFeatureInfo; +class SharedImageInterface; namespace gles2 { class GLES2Interface; @@ -99,6 +100,8 @@ // nullptr if a GrContext fails to initialize on this context. virtual class GrContext* GrContext() = 0; + virtual gpu::SharedImageInterface* SharedImageInterface() = 0; + // Returns the capabilities of the currently bound 3d context. The context // provider must have been successfully bound to a thread before calling this. virtual const gpu::Capabilities& ContextCapabilities() const = 0;
diff --git a/components/viz/service/display_embedder/viz_process_context_provider.cc b/components/viz/service/display_embedder/viz_process_context_provider.cc index e6ff1fe5..da36ef4 100644 --- a/components/viz/service/display_embedder/viz_process_context_provider.cc +++ b/components/viz/service/display_embedder/viz_process_context_provider.cc
@@ -13,6 +13,7 @@ #include "base/single_thread_task_runner.h" #include "base/sys_info.h" #include "base/threading/thread_task_runner_handle.h" +#include "base/trace_event/memory_dump_manager.h" #include "build/build_config.h" #include "components/viz/common/gpu/context_lost_observer.h" #include "components/viz/common/gpu/context_lost_reason.h" @@ -103,12 +104,20 @@ // there will be a circular reference preventing destruction. gles2_implementation_->SetLostContextCallback(base::BindOnce( &VizProcessContextProvider::OnContextLost, base::Unretained(this))); + + base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( + this, "VizProcessContextProvider", base::ThreadTaskRunnerHandle::Get()); } else { UmaRecordContextLost(CONTEXT_INIT_FAILED); } } -VizProcessContextProvider::~VizProcessContextProvider() = default; +VizProcessContextProvider::~VizProcessContextProvider() { + if (context_result_ == gpu::ContextResult::kSuccess) { + base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( + this); + } +} void VizProcessContextProvider::AddRef() const { base::RefCountedThreadSafe<VizProcessContextProvider>::AddRef(); @@ -145,6 +154,10 @@ return gr_context_->get(); } +gpu::SharedImageInterface* VizProcessContextProvider::SharedImageInterface() { + return command_buffer_->GetSharedImageInterface(); +} + ContextCacheController* VizProcessContextProvider::CacheController() { return cache_controller_.get(); } @@ -239,4 +252,20 @@ GetContextLostReason(state.error, state.context_lost_reason)); } +bool VizProcessContextProvider::OnMemoryDump( + const base::trace_event::MemoryDumpArgs& args, + base::trace_event::ProcessMemoryDump* pmd) { + DCHECK_EQ(context_result_, gpu::ContextResult::kSuccess); + + gles2_implementation_->OnMemoryDump(args, pmd); + gles2_helper_->OnMemoryDump(args, pmd); + + if (gr_context_) { + gpu::raster::DumpGrMemoryStatistics( + gr_context_->get(), pmd, + gles2_implementation_->ShareGroupTracingGUID()); + } + return true; +} + } // namespace viz
diff --git a/components/viz/service/display_embedder/viz_process_context_provider.h b/components/viz/service/display_embedder/viz_process_context_provider.h index 00f77f67..960aa48 100644 --- a/components/viz/service/display_embedder/viz_process_context_provider.h +++ b/components/viz/service/display_embedder/viz_process_context_provider.h
@@ -10,6 +10,7 @@ #include <memory> #include "base/observer_list.h" +#include "base/trace_event/memory_dump_provider.h" #include "components/viz/common/gpu/context_cache_controller.h" #include "components/viz/common/gpu/context_provider.h" #include "components/viz/service/viz_service_export.h" @@ -42,7 +43,8 @@ // for the display compositor. class VIZ_SERVICE_EXPORT VizProcessContextProvider : public base::RefCountedThreadSafe<VizProcessContextProvider>, - public ContextProvider { + public ContextProvider, + public base::trace_event::MemoryDumpProvider { public: VizProcessContextProvider( scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor, @@ -60,6 +62,7 @@ gpu::gles2::GLES2Interface* ContextGL() override; gpu::ContextSupport* ContextSupport() override; class GrContext* GrContext() override; + gpu::SharedImageInterface* SharedImageInterface() override; ContextCacheController* CacheController() override; base::Lock* GetLock() override; const gpu::Capabilities& ContextCapabilities() const override; @@ -84,6 +87,10 @@ const gpu::SharedMemoryLimits& mem_limits); void OnContextLost(); + // base::trace_event::MemoryDumpProvider implementation. + bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, + base::trace_event::ProcessMemoryDump* pmd) override; + const gpu::ContextCreationAttribs attributes_; std::unique_ptr<gpu::InProcessCommandBuffer> command_buffer_;
diff --git a/components/viz/test/DEPS b/components/viz/test/DEPS index c5faf37..ad95262 100644 --- a/components/viz/test/DEPS +++ b/components/viz/test/DEPS
@@ -6,6 +6,7 @@ "+gpu/command_buffer/client/context_support.h", "+gpu/command_buffer/client/gles2_interface_stub.h", "+gpu/command_buffer/client/raster_implementation_gles.h", + "+gpu/command_buffer/client/shared_image_interface.h", "+gpu/command_buffer/common/capabilities.h", "+gpu/command_buffer/common/skia_utils.h", "+gpu/command_buffer/common/sync_token.h",
diff --git a/components/viz/test/test_context_provider.cc b/components/viz/test/test_context_provider.cc index 9c4bf7c..6536ef0b 100644 --- a/components/viz/test/test_context_provider.cc +++ b/components/viz/test/test_context_provider.cc
@@ -18,6 +18,7 @@ #include "components/viz/common/gpu/context_cache_controller.h" #include "components/viz/test/test_gles2_interface.h" #include "gpu/command_buffer/client/raster_implementation_gles.h" +#include "gpu/command_buffer/client/shared_image_interface.h" #include "gpu/command_buffer/common/skia_utils.h" #include "gpu/skia_bindings/grcontext_for_gles2_interface.h" #include "third_party/skia/include/gpu/GrContext.h" @@ -110,6 +111,29 @@ DISALLOW_COPY_AND_ASSIGN(TestGLES2InterfaceForContextProvider); }; +class TestSharedImageInterface : public gpu::SharedImageInterface { + public: + ~TestSharedImageInterface() override = default; + + gpu::Mailbox CreateSharedImage(ResourceFormat format, + const gfx::Size& size, + const gfx::ColorSpace& color_space, + uint32_t usage) override { + return gpu::Mailbox::Generate(); + } + + void DestroySharedImage(const gpu::SyncToken& sync_token, + const gpu::Mailbox& mailbox) override {} + + gpu::SyncToken GenUnverifiedSyncToken() override { + return gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, + gpu::CommandBufferId(), ++release_id_); + } + + private: + uint64_t release_id_ = 0; +}; + } // namespace // static @@ -179,6 +203,7 @@ bool support_locking) : support_(std::move(support)), context_gl_(std::move(gl)), + shared_image_interface_(std::make_unique<TestSharedImageInterface>()), support_locking_(support_locking), weak_ptr_factory_(this) { DCHECK(main_thread_checker_.CalledOnValidThread()); @@ -271,6 +296,10 @@ return gr_context_->get(); } +gpu::SharedImageInterface* TestContextProvider::SharedImageInterface() { + return shared_image_interface_.get(); +} + ContextCacheController* TestContextProvider::CacheController() { CheckValidThreadOrLockAcquired(); return cache_controller_.get();
diff --git a/components/viz/test/test_context_provider.h b/components/viz/test/test_context_provider.h index c269468..5bea0bf 100644 --- a/components/viz/test/test_context_provider.h +++ b/components/viz/test/test_context_provider.h
@@ -62,6 +62,7 @@ gpu::raster::RasterInterface* RasterInterface() override; gpu::ContextSupport* ContextSupport() override; class GrContext* GrContext() override; + gpu::SharedImageInterface* SharedImageInterface() override; ContextCacheController* CacheController() override; base::Lock* GetLock() override; void AddObserver(ContextLostObserver* obs) override; @@ -96,6 +97,7 @@ std::unique_ptr<gpu::raster::RasterInterface> raster_context_; std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; std::unique_ptr<ContextCacheController> cache_controller_; + std::unique_ptr<gpu::SharedImageInterface> shared_image_interface_; const bool support_locking_ ALLOW_UNUSED_TYPE; bool bound_ = false;
diff --git a/content/browser/DEPS b/content/browser/DEPS index 70edbe58b..98aedad 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS
@@ -107,6 +107,7 @@ "+third_party/blink/public/platform/modules/locks/lock_manager.mojom.h", "+third_party/blink/public/platform/modules/notifications/web_notification_constants.h", "+third_party/blink/public/platform/modules/service_worker/web_service_worker_error.h", + "+third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h", "+third_party/blink/public/public_buildflags.h", "+third_party/blink/public/web/web_ax_enums.h", "+third_party/blink/public/web/web_console_message.h",
diff --git a/content/browser/android/synchronous_compositor_sync_call_bridge.cc b/content/browser/android/synchronous_compositor_sync_call_bridge.cc index 1f56066..51558de 100644 --- a/content/browser/android/synchronous_compositor_sync_call_bridge.cc +++ b/content/browser/android/synchronous_compositor_sync_call_bridge.cc
@@ -85,7 +85,7 @@ base::AutoLock lock(lock_); if (remote_state_ != RemoteState::READY) return false; - DCHECK(!begin_frame_response_valid_); + CHECK(!begin_frame_response_valid_); if (window_android_in_vsync_) { DCHECK_EQ(window_android_in_vsync_, window_android); return true;
diff --git a/content/browser/background_fetch/background_fetch_data_manager.cc b/content/browser/background_fetch/background_fetch_data_manager.cc index 1fac2a8..f9879bc3 100644 --- a/content/browser/background_fetch/background_fetch_data_manager.cc +++ b/content/browser/background_fetch/background_fetch_data_manager.cc
@@ -133,41 +133,19 @@ NextRequestCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - auto start_next_request = base::BindOnce( - &BackgroundFetchDataManager::AddStartNextPendingRequestTask, - weak_ptr_factory_.GetWeakPtr(), registration_id, std::move(callback)); - - // Get the associated metadata, and add a StartNextPendingRequestTask. - AddDatabaseTask(std::make_unique<background_fetch::GetRegistrationTask>( - this, registration_id.service_worker_registration_id(), - registration_id.origin(), registration_id.developer_id(), - std::move(start_next_request))); -} - -void BackgroundFetchDataManager::AddStartNextPendingRequestTask( - const BackgroundFetchRegistrationId& registration_id, - NextRequestCallback callback, - blink::mojom::BackgroundFetchError error, - const BackgroundFetchRegistration& registration) { - if (error != blink::mojom::BackgroundFetchError::NONE) { - // Stop giving out requests as registration aborted (or otherwise finished). - std::move(callback).Run(nullptr /* request */); - return; - } - AddDatabaseTask( std::make_unique<background_fetch::StartNextPendingRequestTask>( - this, registration_id, registration, std::move(callback))); + this, registration_id, std::move(callback))); } void BackgroundFetchDataManager::MarkRequestAsComplete( const BackgroundFetchRegistrationId& registration_id, scoped_refptr<BackgroundFetchRequestInfo> request_info, - base::OnceClosure closure) { + MarkRequestCompleteCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); AddDatabaseTask(std::make_unique<background_fetch::MarkRequestCompleteTask>( - this, registration_id, std::move(request_info), std::move(closure))); + this, registration_id, std::move(request_info), std::move(callback))); } void BackgroundFetchDataManager::GetSettledFetchesForRegistration(
diff --git a/content/browser/background_fetch/background_fetch_data_manager.h b/content/browser/background_fetch/background_fetch_data_manager.h index 253831a..76b1a60 100644 --- a/content/browser/background_fetch/background_fetch_data_manager.h +++ b/content/browser/background_fetch/background_fetch_data_manager.h
@@ -71,8 +71,11 @@ using GetRegistrationCallback = base::OnceCallback<void(blink::mojom::BackgroundFetchError, const BackgroundFetchRegistration&)>; + using MarkRequestCompleteCallback = + base::OnceCallback<void(blink::mojom::BackgroundFetchError)>; using NextRequestCallback = - base::OnceCallback<void(scoped_refptr<BackgroundFetchRequestInfo>)>; + base::OnceCallback<void(blink::mojom::BackgroundFetchError, + scoped_refptr<BackgroundFetchRequestInfo>)>; BackgroundFetchDataManager( BrowserContext* browser_context, @@ -166,7 +169,7 @@ void MarkRequestAsComplete( const BackgroundFetchRegistrationId& registration_id, scoped_refptr<BackgroundFetchRequestInfo> request_info, - base::OnceClosure closure) override; + MarkRequestCompleteCallback callback) override; void ShutdownOnIO(); @@ -193,12 +196,6 @@ return quota_manager_proxy_.get(); } - void AddStartNextPendingRequestTask( - const BackgroundFetchRegistrationId& registration_id, - NextRequestCallback callback, - blink::mojom::BackgroundFetchError error, - const BackgroundFetchRegistration& registration); - void AddDatabaseTask(std::unique_ptr<background_fetch::DatabaseTask> task); // DatabaseTaskHost implementation.
diff --git a/content/browser/background_fetch/background_fetch_data_manager_unittest.cc b/content/browser/background_fetch/background_fetch_data_manager_unittest.cc index 4b2a107..63173ab 100644 --- a/content/browser/background_fetch/background_fetch_data_manager_unittest.cc +++ b/content/browser/background_fetch/background_fetch_data_manager_unittest.cc
@@ -312,7 +312,9 @@ // BackgroundFetchDataManager::PopNextRequest(). void PopNextRequest( const BackgroundFetchRegistrationId& registration_id, + blink::mojom::BackgroundFetchError* out_error, scoped_refptr<BackgroundFetchRequestInfo>* out_request_info) { + DCHECK(out_error); DCHECK(out_request_info); base::RunLoop run_loop; @@ -320,7 +322,7 @@ registration_id, base::BindOnce(&BackgroundFetchDataManagerTest::DidPopNextRequest, base::Unretained(this), run_loop.QuitClosure(), - out_request_info)); + out_error, out_request_info)); run_loop.Run(); } @@ -353,13 +355,16 @@ // Synchronous version of BackgroundFetchDataManager::MarkRequestAsComplete(). void MarkRequestAsComplete( const BackgroundFetchRegistrationId& registration_id, - BackgroundFetchRequestInfo* request_info) { + BackgroundFetchRequestInfo* request_info, + blink::mojom::BackgroundFetchError* out_error) { + DCHECK(out_error); + base::RunLoop run_loop; background_fetch_data_manager_->MarkRequestAsComplete( registration_id, request_info, base::BindOnce( &BackgroundFetchDataManagerTest::DidMarkRequestAsComplete, - base::Unretained(this), run_loop.QuitClosure())); + base::Unretained(this), run_loop.QuitClosure(), out_error)); run_loop.Run(); } @@ -615,13 +620,19 @@ void DidPopNextRequest( base::OnceClosure quit_closure, + blink::mojom::BackgroundFetchError* out_error, scoped_refptr<BackgroundFetchRequestInfo>* out_request_info, + blink::mojom::BackgroundFetchError error, scoped_refptr<BackgroundFetchRequestInfo> request_info) { + *out_error = error; *out_request_info = request_info; std::move(quit_closure).Run(); } - void DidMarkRequestAsComplete(base::OnceClosure quit_closure) { + void DidMarkRequestAsComplete(base::OnceClosure quit_closure, + blink::mojom::BackgroundFetchError* out_error, + blink::mojom::BackgroundFetchError error) { + *out_error = error; std::move(quit_closure).Run(); } @@ -1108,6 +1119,7 @@ int64_t sw_id = RegisterServiceWorker(); ASSERT_NE(blink::mojom::kInvalidServiceWorkerRegistrationId, sw_id); + blink::mojom::BackgroundFetchError error; scoped_refptr<BackgroundFetchRequestInfo> request_info; BackgroundFetchRegistrationId registration_id( @@ -1115,7 +1127,8 @@ // There registration hasn't been created yet, so there are no pending // requests. - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); EXPECT_FALSE(request_info); EXPECT_EQ( GetRequestStats(sw_id), @@ -1124,7 +1137,6 @@ std::vector<ServiceWorkerFetchRequest> requests(2u); BackgroundFetchOptions options; - blink::mojom::BackgroundFetchError error; { EXPECT_CALL(*this, OnRegistrationCreated(registration_id, _, _, _, _)); @@ -1139,7 +1151,8 @@ 0 /* completed_requests */})); // Popping should work now. - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); EXPECT_TRUE(request_info); EXPECT_EQ(request_info->request_index(), 0); EXPECT_FALSE(request_info->download_guid().empty()); @@ -1150,7 +1163,8 @@ // Mark as complete. AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get()); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_EQ( GetRequestStats(sw_id), (ResponseStateStats{1 /* pending_requests */, 0 /* active_requests */, @@ -1158,7 +1172,8 @@ RestartDataManagerFromPersistentStorage(); - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); EXPECT_TRUE(request_info); EXPECT_EQ(request_info->request_index(), 1); EXPECT_FALSE(request_info->download_guid().empty()); @@ -1169,14 +1184,16 @@ // Mark as complete. AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get()); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_EQ( GetRequestStats(sw_id), (ResponseStateStats{0 /* pending_requests */, 0 /* active_requests */, 2 /* completed_requests */})); // We are out of pending requests. - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); EXPECT_FALSE(request_info); EXPECT_EQ( GetRequestStats(sw_id), @@ -1207,28 +1224,34 @@ EXPECT_EQ(registration.download_total, 0u); scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get(), true /* succeeded */); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); registration = GetRegistration(sw_id, origin(), kExampleDeveloperId, &error); ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); EXPECT_EQ(registration.download_total, kResponseFileSize); - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get(), true /* succeeded */); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); registration = GetRegistration(sw_id, origin(), kExampleDeveloperId, &error); ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); EXPECT_EQ(registration.download_total, 2 * kResponseFileSize); - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get(), false /* succeeded */); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); registration = GetRegistration(sw_id, origin(), kExampleDeveloperId, &error); ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); @@ -1254,12 +1277,14 @@ } scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); AnnotateRequestInfoWithFakeDownloadManagerData( request_info.get(), true /* succeeded */, true /* over_quota */); { EXPECT_CALL(*this, OnQuotaExceeded(registration_id)); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::QUOTA_EXCEEDED); } } @@ -1281,12 +1306,14 @@ } scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get(), true /* success */); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); EXPECT_TRUE(HasCache(kExampleUniqueId)); EXPECT_FALSE(HasCache("foo")); @@ -1294,12 +1321,14 @@ EXPECT_TRUE(MatchCache(requests[0])); EXPECT_FALSE(MatchCache(requests[1])); - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get(), true /* success */); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); EXPECT_TRUE(MatchCache(requests[0])); EXPECT_TRUE(MatchCache(requests[1])); @@ -1328,12 +1357,14 @@ } scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get(), true /* success */); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); EXPECT_TRUE(HasCache(kExampleUniqueId)); EXPECT_TRUE(MatchCache(request)); @@ -1382,10 +1413,12 @@ for (size_t i = 0; i < requests.size(); i++) { scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get()); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); } RestartDataManagerFromPersistentStorage(); @@ -1435,11 +1468,13 @@ EXPECT_EQ(settled_fetches.size(), 0u); scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get(), true /* success */); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); GetSettledFetchesForRegistration( registration_id, base::nullopt /* request_to_match */, @@ -1449,11 +1484,13 @@ EXPECT_TRUE(succeeded); EXPECT_EQ(settled_fetches.size(), 1u); - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get(), true /* success */); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); GetSettledFetchesForRegistration( registration_id, base::nullopt /* request_to_match */, @@ -1502,10 +1539,12 @@ for (size_t i = 0; i < requests.size(); i++) { SCOPED_TRACE(i); scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get()); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); } EXPECT_EQ( @@ -1547,10 +1586,12 @@ for (size_t i = 0; i < requests.size() - 1; i++) { SCOPED_TRACE(i); scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get()); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); } EXPECT_EQ( @@ -1593,10 +1634,12 @@ for (size_t i = 0; i < requests.size(); i++) { SCOPED_TRACE(i); scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get()); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); } EXPECT_EQ( @@ -1738,11 +1781,16 @@ // Mark one request as complete and start another. scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); + AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get()); - MarkRequestAsComplete(registration_id, request_info.get()); - PopNextRequest(registration_id, &request_info); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); + + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); { std::vector<BackgroundFetchInitializationData> data = @@ -1868,11 +1916,13 @@ } scoped_refptr<BackgroundFetchRequestInfo> request_info; - PopNextRequest(registration_id, &request_info); + PopNextRequest(registration_id, &error, &request_info); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); ASSERT_TRUE(request_info); AnnotateRequestInfoWithFakeDownloadManagerData(request_info.get(), true /* success */); - MarkRequestAsComplete(registration_id, request_info.get()); + MarkRequestAsComplete(registration_id, request_info.get(), &error); + EXPECT_EQ(error, blink::mojom::BackgroundFetchError::NONE); bool succeeded = false; std::vector<BackgroundFetchSettledFetch> settled_fetches;
diff --git a/content/browser/background_fetch/background_fetch_scheduler.cc b/content/browser/background_fetch/background_fetch_scheduler.cc index ec5c2c12..67d6ec8a 100644 --- a/content/browser/background_fetch/background_fetch_scheduler.cc +++ b/content/browser/background_fetch/background_fetch_scheduler.cc
@@ -100,6 +100,7 @@ } void BackgroundFetchScheduler::DidPopNextRequest( + blink::mojom::BackgroundFetchError error, scoped_refptr<BackgroundFetchRequestInfo> request_info) { // It's possible for the |active_controller_| to have been aborted while the // next request was being retrieved. Bail out when that happens. @@ -108,16 +109,16 @@ return; } - // There might've been a storage error when |request_info| could not be loaded - // from the database. Bail out in this case as well. - if (!request_info) { - // TODO(peter): Should we abort the |active_controller_| in this case? + if (error != blink::mojom::BackgroundFetchError::NONE) { + active_controller_->Finish( + blink::mojom::BackgroundFetchFailureReason::SERVICE_WORKER_UNAVAILABLE); active_controller_ = nullptr; - ScheduleDownload(); return; } + DCHECK(request_info); + // Otherwise start the |request_info| through the live Job Controller. active_controller_->StartRequest( std::move(request_info), @@ -138,12 +139,22 @@ weak_ptr_factory_.GetWeakPtr())); } -void BackgroundFetchScheduler::DidMarkRequestAsComplete() { +void BackgroundFetchScheduler::DidMarkRequestAsComplete( + blink::mojom::BackgroundFetchError error) { // It's possible for the |active_controller_| to have been aborted while the // request was being marked as completed. Bail out in that case. if (!active_controller_) return; + if (error != blink::mojom::BackgroundFetchError::NONE) { + DCHECK_EQ(error, blink::mojom::BackgroundFetchError::STORAGE_ERROR); + active_controller_->Finish( + blink::mojom::BackgroundFetchFailureReason::SERVICE_WORKER_UNAVAILABLE); + active_controller_ = nullptr; + ScheduleDownload(); + return; + } + // Continue with the |active_controller_| while there are files pending. if (active_controller_->HasMoreRequests()) { request_provider_->PopNextRequest(
diff --git a/content/browser/background_fetch/background_fetch_scheduler.h b/content/browser/background_fetch/background_fetch_scheduler.h index b8305704..4bf96dc 100644 --- a/content/browser/background_fetch/background_fetch_scheduler.h +++ b/content/browser/background_fetch/background_fetch_scheduler.h
@@ -73,8 +73,11 @@ FinishedCallback finished_callback_; }; + using MarkRequestCompleteCallback = + base::OnceCallback<void(blink::mojom::BackgroundFetchError)>; using NextRequestCallback = - base::OnceCallback<void(scoped_refptr<BackgroundFetchRequestInfo>)>; + base::OnceCallback<void(blink::mojom::BackgroundFetchError, + scoped_refptr<BackgroundFetchRequestInfo>)>; class CONTENT_EXPORT RequestProvider { public: @@ -90,7 +93,7 @@ virtual void MarkRequestAsComplete( const BackgroundFetchRegistrationId& registration_id, scoped_refptr<BackgroundFetchRequestInfo> request_info, - base::OnceClosure closure) = 0; + MarkRequestCompleteCallback callback) = 0; }; explicit BackgroundFetchScheduler(RequestProvider* request_provider); @@ -108,11 +111,12 @@ void ScheduleDownload(); void DidPopNextRequest( + blink::mojom::BackgroundFetchError error, scoped_refptr<BackgroundFetchRequestInfo> request_info); void MarkRequestAsComplete( scoped_refptr<BackgroundFetchRequestInfo> request_info); - void DidMarkRequestAsComplete(); + void DidMarkRequestAsComplete(blink::mojom::BackgroundFetchError error); RequestProvider* request_provider_;
diff --git a/content/browser/background_fetch/background_fetch_scheduler_unittest.cc b/content/browser/background_fetch/background_fetch_scheduler_unittest.cc index d527b2fd..78a726d 100644 --- a/content/browser/background_fetch/background_fetch_scheduler_unittest.cc +++ b/content/browser/background_fetch/background_fetch_scheduler_unittest.cc
@@ -96,14 +96,15 @@ 0 /* request_count */, fetch_request); request->InitializeDownloadGuid(); - std::move(callback).Run(std::move(request)); + std::move(callback).Run(blink::mojom::BackgroundFetchError::NONE, + std::move(request)); } void MarkRequestAsComplete( const BackgroundFetchRegistrationId& registration_id, scoped_refptr<BackgroundFetchRequestInfo> request_info, - base::OnceClosure closure) override { - std::move(closure).Run(); + BackgroundFetchScheduler::MarkRequestCompleteCallback closure) override { + std::move(closure).Run(blink::mojom::BackgroundFetchError::NONE); } protected:
diff --git a/content/browser/background_fetch/background_fetch_service_unittest.cc b/content/browser/background_fetch/background_fetch_service_unittest.cc index bacc7c55..412d0b2 100644 --- a/content/browser/background_fetch/background_fetch_service_unittest.cc +++ b/content/browser/background_fetch/background_fetch_service_unittest.cc
@@ -239,10 +239,11 @@ run_loop.Run(); + // Allow all the DatabaseTasks resulting from Abort to complete. + thread_bundle_.RunUntilIdle(); + // We only delete the registration if we successfully abort. if (*out_error == blink::mojom::BackgroundFetchError::NONE) { - // TODO(crbug.com/850894): The Abort callback is being resolved early. - base::RunLoop().RunUntilIdle(); // The error passed to the histogram counter is not related to this // |*out_error|, but the result of // BackgroundFetchDataManager::DeleteRegistration. For the purposes these
diff --git a/content/browser/background_fetch/storage/mark_request_complete_task.cc b/content/browser/background_fetch/storage/mark_request_complete_task.cc index a6c9de6..5f4fb02 100644 --- a/content/browser/background_fetch/storage/mark_request_complete_task.cc +++ b/content/browser/background_fetch/storage/mark_request_complete_task.cc
@@ -40,11 +40,11 @@ DatabaseTaskHost* host, BackgroundFetchRegistrationId registration_id, scoped_refptr<BackgroundFetchRequestInfo> request_info, - base::OnceClosure closure) + MarkRequestCompleteCallback callback) : DatabaseTask(host), registration_id_(registration_id), request_info_(std::move(request_info)), - closure_(std::move(closure)), + callback_(std::move(callback)), weak_factory_(this) {} MarkRequestCompleteTask::~MarkRequestCompleteTask() = default; @@ -67,6 +67,8 @@ response->response_type = network::mojom::FetchResponseType::kDefault; response->response_time = request_info_->GetResponseTime(); + // TODO(crbug.com/884672): Move cross origin checks to when the response + // headers are available. BackgroundFetchCrossOriginFilter filter(registration_id_.origin(), *request_info_); if (filter.CanPopulateBody()) @@ -292,15 +294,18 @@ void MarkRequestCompleteTask::DidStoreMetadata( base::OnceClosure done_closure, blink::ServiceWorkerStatusCode status) { - SetStorageError(BackgroundFetchStorageError::kServiceWorkerStorageError); + if (ToDatabaseStatus(status) != DatabaseStatus::kOk) + SetStorageError(BackgroundFetchStorageError::kServiceWorkerStorageError); std::move(done_closure).Run(); } void MarkRequestCompleteTask::FinishWithError( blink::mojom::BackgroundFetchError error) { + if (HasStorageError()) + error = blink::mojom::BackgroundFetchError::STORAGE_ERROR; ReportStorageError(); - std::move(closure_).Run(); + std::move(callback_).Run(error); Finished(); }
diff --git a/content/browser/background_fetch/storage/mark_request_complete_task.h b/content/browser/background_fetch/storage/mark_request_complete_task.h index 09e1156..870f781 100644 --- a/content/browser/background_fetch/storage/mark_request_complete_task.h +++ b/content/browser/background_fetch/storage/mark_request_complete_task.h
@@ -21,11 +21,14 @@ // download response in cache storage. class MarkRequestCompleteTask : public DatabaseTask { public: + using MarkRequestCompleteCallback = + base::OnceCallback<void(blink::mojom::BackgroundFetchError)>; + MarkRequestCompleteTask( DatabaseTaskHost* host, BackgroundFetchRegistrationId registration_id, scoped_refptr<BackgroundFetchRequestInfo> request_info, - base::OnceClosure closure); + MarkRequestCompleteCallback callback); ~MarkRequestCompleteTask() override; @@ -73,7 +76,7 @@ BackgroundFetchRegistrationId registration_id_; scoped_refptr<BackgroundFetchRequestInfo> request_info_; - base::OnceClosure closure_; + MarkRequestCompleteCallback callback_; proto::BackgroundFetchCompletedRequest completed_request_; bool is_response_successful_ = true;
diff --git a/content/browser/background_fetch/storage/start_next_pending_request_task.cc b/content/browser/background_fetch/storage/start_next_pending_request_task.cc index acccbe3..7fb5d74 100644 --- a/content/browser/background_fetch/storage/start_next_pending_request_task.cc +++ b/content/browser/background_fetch/storage/start_next_pending_request_task.cc
@@ -16,11 +16,9 @@ StartNextPendingRequestTask::StartNextPendingRequestTask( DatabaseTaskHost* host, const BackgroundFetchRegistrationId& registration_id, - const BackgroundFetchRegistration& registration, NextRequestCallback callback) : DatabaseTask(host), registration_id_(registration_id), - registration_(registration), callback_(std::move(callback)), weak_factory_(this) { DCHECK(!registration_id_.is_null()); @@ -35,7 +33,7 @@ void StartNextPendingRequestTask::GetPendingRequests() { service_worker_context()->GetRegistrationUserDataByKeyPrefix( registration_id_.service_worker_registration_id(), - PendingRequestKeyPrefix(registration_.unique_id), + PendingRequestKeyPrefix(registration_id_.unique_id()), base::BindOnce(&StartNextPendingRequestTask::DidGetPendingRequests, weak_factory_.GetWeakPtr())); } @@ -65,43 +63,7 @@ return; } - // Make sure there isn't already an Active Request. - // This might happen if the browser is killed in-between writes. - service_worker_context()->GetRegistrationUserData( - registration_id_.service_worker_registration_id(), - {ActiveRequestKey(pending_request_.unique_id(), - pending_request_.request_index())}, - base::BindOnce(&StartNextPendingRequestTask::DidFindActiveRequest, - weak_factory_.GetWeakPtr())); -} - -void StartNextPendingRequestTask::DidFindActiveRequest( - const std::vector<std::string>& data, - blink::ServiceWorkerStatusCode status) { - switch (ToDatabaseStatus(status)) { - case DatabaseStatus::kFailed: - SetStorageErrorAndFinish( - BackgroundFetchStorageError::kServiceWorkerStorageError); - return; - case DatabaseStatus::kNotFound: - CreateAndStoreActiveRequest(); - return; - case DatabaseStatus::kOk: - // We already stored the active request. - if (!active_request_.ParseFromString(data.front())) { - // Service worker database has been corrupted. Abandon fetches. - AbandonFetches(registration_id_.service_worker_registration_id()); - SetStorageErrorAndFinish( - BackgroundFetchStorageError::kServiceWorkerStorageError); - return; - } - StartDownload(); - return; - } - NOTREACHED(); -} - -void StartNextPendingRequestTask::CreateAndStoreActiveRequest() { + // Create an active request. proto::BackgroundFetchActiveRequest active_request; active_request_.set_download_guid(base::GenerateGUID()); @@ -132,19 +94,12 @@ BackgroundFetchStorageError::kServiceWorkerStorageError); return; } - StartDownload(); -} -void StartNextPendingRequestTask::StartDownload() { - DCHECK(!active_request_.download_guid().empty()); - - auto next_request = base::MakeRefCounted<BackgroundFetchRequestInfo>( + next_request_ = base::MakeRefCounted<BackgroundFetchRequestInfo>( active_request_.request_index(), ServiceWorkerFetchRequest::ParseFromString( active_request_.serialized_request())); - next_request->SetDownloadGuid(active_request_.download_guid()); - - std::move(callback_).Run(next_request); + next_request_->SetDownloadGuid(active_request_.download_guid()); // Delete the pending request. service_worker_context()->ClearRegistrationUserData( @@ -169,8 +124,7 @@ blink::mojom::BackgroundFetchError error) { ReportStorageError(); - if (callback_) - std::move(callback_).Run(nullptr /* request */); + std::move(callback_).Run(error, std::move(next_request_)); Finished(); // Destroys |this|. }
diff --git a/content/browser/background_fetch/storage/start_next_pending_request_task.h b/content/browser/background_fetch/storage/start_next_pending_request_task.h index 5faaeb0..48be7080 100644 --- a/content/browser/background_fetch/storage/start_next_pending_request_task.h +++ b/content/browser/background_fetch/storage/start_next_pending_request_task.h
@@ -21,12 +21,12 @@ class StartNextPendingRequestTask : public DatabaseTask { public: using NextRequestCallback = - base::OnceCallback<void(scoped_refptr<BackgroundFetchRequestInfo>)>; + base::OnceCallback<void(blink::mojom::BackgroundFetchError, + scoped_refptr<BackgroundFetchRequestInfo>)>; StartNextPendingRequestTask( DatabaseTaskHost* host, const BackgroundFetchRegistrationId& registration_id, - const BackgroundFetchRegistration& registration, NextRequestCallback callback); ~StartNextPendingRequestTask() override; @@ -43,12 +43,8 @@ void DidFindActiveRequest(const std::vector<std::string>& data, blink::ServiceWorkerStatusCode status); - void CreateAndStoreActiveRequest(); - void DidStoreActiveRequest(blink::ServiceWorkerStatusCode status); - void StartDownload(); - void DidDeletePendingRequest(blink::ServiceWorkerStatusCode status); void FinishWithError(blink::mojom::BackgroundFetchError error) override; @@ -56,7 +52,6 @@ std::string HistogramName() const override; BackgroundFetchRegistrationId registration_id_; - BackgroundFetchRegistration registration_; NextRequestCallback callback_; // protos don't support move semantics, so these class members will be used @@ -64,6 +59,8 @@ proto::BackgroundFetchPendingRequest pending_request_; proto::BackgroundFetchActiveRequest active_request_; + scoped_refptr<BackgroundFetchRequestInfo> next_request_; + base::WeakPtrFactory<StartNextPendingRequestTask> weak_factory_; // Keep as last.
diff --git a/content/browser/code_cache/generated_code_cache.cc b/content/browser/code_cache/generated_code_cache.cc index 1634e67..c81475e4 100644 --- a/content/browser/code_cache/generated_code_cache.cc +++ b/content/browser/code_cache/generated_code_cache.cc
@@ -451,13 +451,28 @@ if (rv != buffer->size()) { CollectStatistics(CacheEntryStatus::kMiss); std::move(callback).Run(base::Time(), std::vector<uint8_t>()); + } else if (buffer->size() < kResponseTimeSizeInBytes) { + // TODO(crbug.com/886892): Change the implementation, so serialize requests + // for the same key here. When we do that, this case should not arise. + // We might be reading an entry before the write was completed. This can + // happen if we have a write and read operation for the same key almost at + // the same time and they interleave as: + // W(Create) -> R(Open) -> R(Read) -> W(Write). + CollectStatistics(CacheEntryStatus::kIncompleteEntry); + std::move(callback).Run(base::Time(), std::vector<uint8_t>()); } else { + // DiskCache ensures that the operations that are queued for an entry + // go in order. Hence, we would either read an empty data or read the full + // data. Please look at comment in else to see why we read empty data. CollectStatistics(CacheEntryStatus::kHit); int64_t raw_response_time = *(reinterpret_cast<int64_t*>(buffer->data())); base::Time response_time = base::Time::FromDeltaSinceWindowsEpoch( base::TimeDelta::FromMicroseconds(raw_response_time)); - std::vector<uint8_t> data(buffer->data() + kResponseTimeSizeInBytes, - buffer->data() + buffer->size()); + std::vector<uint8_t> data; + if (buffer->size() > kResponseTimeSizeInBytes) { + data = std::vector<uint8_t>(buffer->data() + kResponseTimeSizeInBytes, + buffer->data() + buffer->size()); + } std::move(callback).Run(response_time, data); } }
diff --git a/content/browser/code_cache/generated_code_cache.h b/content/browser/code_cache/generated_code_cache.h index 1f965a9..dee6fcd 100644 --- a/content/browser/code_cache/generated_code_cache.h +++ b/content/browser/code_cache/generated_code_cache.h
@@ -44,7 +44,8 @@ kUpdate, kCreate, kError, - kMaxValue = kError + kIncompleteEntry, + kMaxValue = kIncompleteEntry }; // Creates a GeneratedCodeCache with the specified path and the maximum size.
diff --git a/content/browser/code_cache/generated_code_cache_unittest.cc b/content/browser/code_cache/generated_code_cache_unittest.cc index 4f005c8..4c9b2ab 100644 --- a/content/browser/code_cache/generated_code_cache_unittest.cc +++ b/content/browser/code_cache/generated_code_cache_unittest.cc
@@ -167,6 +167,22 @@ ASSERT_TRUE(received_null_); } +TEST_F(GeneratedCodeCacheTest, WriteEntryWithEmptyData) { + GURL url(kInitialUrl); + url::Origin origin = url::Origin::Create(GURL(kInitialOrigin)); + + InitializeCache(); + base::Time response_time = base::Time::Now(); + WriteToCache(url, origin, std::string(), response_time); + scoped_task_environment_.RunUntilIdle(); + FetchFromCache(url, origin); + scoped_task_environment_.RunUntilIdle(); + + ASSERT_TRUE(received_); + ASSERT_TRUE(received_null_); + EXPECT_EQ(response_time, received_response_time_); +} + TEST_F(GeneratedCodeCacheTest, FetchEntryPendingOp) { GURL url(kInitialUrl); url::Origin origin = url::Origin::Create(GURL(kInitialOrigin));
diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc index 64115be..f48808a 100644 --- a/content/browser/devtools/protocol/page_handler.cc +++ b/content/browser/devtools/protocol/page_handler.cc
@@ -404,7 +404,7 @@ WebContentsImpl* web_contents = GetWebContents(); if (!web_contents) return Response::Error("Not attached to a page"); - web_contents->DispatchBeforeUnload(); + web_contents->DispatchBeforeUnload(false /* auto_cancel */); return Response::OK(); }
diff --git a/content/browser/frame_host/mixed_content_navigation_throttle.cc b/content/browser/frame_host/mixed_content_navigation_throttle.cc index e564719..218c6f7 100644 --- a/content/browser/frame_host/mixed_content_navigation_throttle.cc +++ b/content/browser/frame_host/mixed_content_navigation_throttle.cc
@@ -19,6 +19,7 @@ #include "content/public/common/origin_util.h" #include "content/public/common/web_preferences.h" #include "net/base/url_util.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "url/gurl.h" #include "url/origin.h" #include "url/url_constants.h" @@ -294,7 +295,7 @@ // Based off of MixedContentChecker::count. void MixedContentNavigationThrottle::ReportBasicMixedContentFeatures( - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, blink::WebMixedContentContextType mixed_content_context_type, const WebPreferences& prefs) { mixed_content_features_.insert(MIXED_CONTENT_PRESENT); @@ -311,19 +312,19 @@ // ever be found here. UseCounterFeature feature; switch (request_context_type) { - case REQUEST_CONTEXT_TYPE_INTERNAL: + case blink::mojom::RequestContextType::INTERNAL: feature = MIXED_CONTENT_INTERNAL; break; - case REQUEST_CONTEXT_TYPE_PREFETCH: + case blink::mojom::RequestContextType::PREFETCH: feature = MIXED_CONTENT_PREFETCH; break; - case REQUEST_CONTEXT_TYPE_AUDIO: - case REQUEST_CONTEXT_TYPE_DOWNLOAD: - case REQUEST_CONTEXT_TYPE_FAVICON: - case REQUEST_CONTEXT_TYPE_IMAGE: - case REQUEST_CONTEXT_TYPE_PLUGIN: - case REQUEST_CONTEXT_TYPE_VIDEO: + case blink::mojom::RequestContextType::AUDIO: + case blink::mojom::RequestContextType::DOWNLOAD: + case blink::mojom::RequestContextType::FAVICON: + case blink::mojom::RequestContextType::IMAGE: + case blink::mojom::RequestContextType::PLUGIN: + case blink::mojom::RequestContextType::VIDEO: default: NOTREACHED() << "RequestContextType has value " << request_context_type << " and has WebMixedContentContextType of "
diff --git a/content/browser/frame_host/mixed_content_navigation_throttle.h b/content/browser/frame_host/mixed_content_navigation_throttle.h index 4c884ab..152ce97 100644 --- a/content/browser/frame_host/mixed_content_navigation_throttle.h +++ b/content/browser/frame_host/mixed_content_navigation_throttle.h
@@ -12,7 +12,7 @@ #include "content/common/content_export.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_throttle.h" -#include "content/public/common/request_context_type.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_mixed_content_context_type.h" namespace content { @@ -71,7 +71,7 @@ // Records basic mixed content "feature" usage when any kind of mixed content // is found. void ReportBasicMixedContentFeatures( - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, blink::WebMixedContentContextType mixed_content_context_type, const WebPreferences& prefs);
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc index 3fb4b74..6f7ec42 100644 --- a/content/browser/frame_host/navigation_handle_impl.cc +++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -162,7 +162,7 @@ bool has_user_gesture, ui::PageTransition transition, bool is_external_protocol, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, blink::WebMixedContentContextType mixed_content_context_type, base::TimeTicks input_start) { return std::unique_ptr<NavigationHandleImpl>(new NavigationHandleImpl( @@ -194,7 +194,7 @@ bool has_user_gesture, ui::PageTransition transition, bool is_external_protocol, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, blink::WebMixedContentContextType mixed_content_context_type, base::TimeTicks input_start) : url_(url), @@ -593,11 +593,6 @@ ResumeInternal(); } -bool NavigationHandleImpl::IsDeferredForTesting() { - return state_ == DEFERRING_START || state_ == DEFERRING_REDIRECT || - state_ == DEFERRING_FAILURE || state_ == DEFERRING_RESPONSE; -} - bool NavigationHandleImpl::WasStartedFromContextMenu() const { return started_from_context_menu_; }
diff --git a/content/browser/frame_host/navigation_handle_impl.h b/content/browser/frame_host/navigation_handle_impl.h index 39867552..be8ce31 100644 --- a/content/browser/frame_host/navigation_handle_impl.h +++ b/content/browser/frame_host/navigation_handle_impl.h
@@ -28,7 +28,7 @@ #include "content/public/browser/navigation_throttle.h" #include "content/public/browser/navigation_type.h" #include "content/public/browser/restore_type.h" -#include "content/public/common/request_context_type.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_mixed_content_context_type.h" #include "url/gurl.h" @@ -75,8 +75,8 @@ bool has_user_gesture = false, ui::PageTransition transition = ui::PAGE_TRANSITION_LINK, bool is_external_protocol = false, - RequestContextType request_context_type = - REQUEST_CONTEXT_TYPE_UNSPECIFIED, + blink::mojom::RequestContextType request_context_type = + blink::mojom::RequestContextType::UNSPECIFIED, blink::WebMixedContentContextType mixed_content_context_type = blink::WebMixedContentContextType::kBlockable, base::TimeTicks input_start = base::TimeTicks()); @@ -152,7 +152,6 @@ const std::string& raw_response_header) override; void CallDidCommitNavigationForTesting(const GURL& url) override; void CallResumeForTesting() override; - bool IsDeferredForTesting() override; bool WasStartedFromContextMenu() const override; const GURL& GetSearchableFormURL() override; const std::string& GetSearchableFormEncoding() override; @@ -196,7 +195,7 @@ // expose the NavigationHandle when navigating to an InterstitialPage. NavigatorDelegate* GetDelegate() const; - RequestContextType request_context_type() const { + blink::mojom::RequestContextType request_context_type() const { DCHECK_GE(state_, WILL_SEND_REQUEST); return request_context_type_; } @@ -399,7 +398,7 @@ bool has_user_gesture, ui::PageTransition transition, bool is_external_protocol, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, blink::WebMixedContentContextType mixed_content_context_type, base::TimeTicks input_start); @@ -514,7 +513,7 @@ int pending_nav_entry_id_; // The fetch request context type. - RequestContextType request_context_type_; + blink::mojom::RequestContextType request_context_type_; // The mixed content context type for potential mixed content checks. blink::WebMixedContentContextType mixed_content_context_type_;
diff --git a/content/browser/frame_host/navigation_handle_impl_browsertest.cc b/content/browser/frame_host/navigation_handle_impl_browsertest.cc index b3f8abed..1aab41a 100644 --- a/content/browser/frame_host/navigation_handle_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_handle_impl_browsertest.cc
@@ -20,7 +20,6 @@ #include "content/public/common/browser_side_navigation_policy.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/url_constants.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" @@ -36,6 +35,7 @@ #include "net/dns/mock_host_resolver.h" #include "net/test/url_request/url_request_failed_job.h" #include "testing/gmock/include/gmock/gmock.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "ui/base/page_transition_types.h" #include "url/url_constants.h" @@ -78,7 +78,9 @@ const char* GetNameForLogging() override { return "TestNavigationThrottle"; } - RequestContextType request_context_type() { return request_context_type_; } + blink::mojom::RequestContextType request_context_type() { + return request_context_type_; + } // Expose Resume and Cancel to the installer. void ResumeNavigation() { Resume(); } @@ -92,7 +94,7 @@ NavigationThrottle::ThrottleCheckResult WillStartRequest() override { NavigationHandleImpl* navigation_handle_impl = static_cast<NavigationHandleImpl*>(navigation_handle()); - CHECK_NE(REQUEST_CONTEXT_TYPE_UNSPECIFIED, + CHECK_NE(blink::mojom::RequestContextType::UNSPECIFIED, navigation_handle_impl->request_context_type()); request_context_type_ = navigation_handle_impl->request_context_type(); @@ -140,7 +142,8 @@ base::Closure did_call_will_redirect_; base::Closure did_call_will_fail_; base::Closure did_call_will_process_; - RequestContextType request_context_type_ = REQUEST_CONTEXT_TYPE_UNSPECIFIED; + blink::mojom::RequestContextType request_context_type_ = + blink::mojom::RequestContextType::UNSPECIFIED; }; // Installs a TestNavigationThrottle either on all following requests or on @@ -1197,7 +1200,7 @@ EXPECT_EQ(main_url, url_recorder.urls().back()); EXPECT_EQ(1ul, url_recorder.urls().size()); // Checks the main frame RequestContextType. - EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, + EXPECT_EQ(blink::mojom::RequestContextType::LOCATION, installer.navigation_throttle()->request_context_type()); // Ditto for frame b navigation. @@ -1206,7 +1209,7 @@ EXPECT_EQ(2, installer.install_count()); EXPECT_EQ(b_url, url_recorder.urls().back()); EXPECT_EQ(2ul, url_recorder.urls().size()); - EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, + EXPECT_EQ(blink::mojom::RequestContextType::LOCATION, installer.navigation_throttle()->request_context_type()); // Ditto for frame c navigation. @@ -1215,7 +1218,7 @@ EXPECT_EQ(3, installer.install_count()); EXPECT_EQ(c_url, url_recorder.urls().back()); EXPECT_EQ(3ul, url_recorder.urls().size()); - EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, + EXPECT_EQ(blink::mojom::RequestContextType::LOCATION, installer.navigation_throttle()->request_context_type()); // Lets the final navigation finish so that we conclude running the @@ -1253,7 +1256,7 @@ EXPECT_TRUE(link_manager.WaitForRequestStart()); EXPECT_EQ(link_url, url_recorder.urls().back()); EXPECT_EQ(2ul, url_recorder.urls().size()); - EXPECT_EQ(REQUEST_CONTEXT_TYPE_HYPERLINK, + EXPECT_EQ(blink::mojom::RequestContextType::HYPERLINK, installer.navigation_throttle()->request_context_type()); // Finishes the last navigation. @@ -1287,7 +1290,7 @@ EXPECT_TRUE(post_manager.WaitForRequestStart()); EXPECT_EQ(post_url, url_recorder.urls().back()); EXPECT_EQ(2ul, url_recorder.urls().size()); - EXPECT_EQ(REQUEST_CONTEXT_TYPE_FORM, + EXPECT_EQ(blink::mojom::RequestContextType::FORM, installer.navigation_throttle()->request_context_type()); // Finishes the last navigation.
diff --git a/content/browser/frame_host/navigation_handle_impl_unittest.cc b/content/browser/frame_host/navigation_handle_impl_unittest.cc index 6704b53c..62d5ec1 100644 --- a/content/browser/frame_host/navigation_handle_impl_unittest.cc +++ b/content/browser/frame_host/navigation_handle_impl_unittest.cc
@@ -8,7 +8,6 @@ #include "content/public/browser/navigation_throttle.h" #include "content/public/browser/ssl_status.h" #include "content/public/common/browser_side_navigation_policy.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/url_constants.h" #include "content/public/test/browser_side_navigation_test_utils.h" #include "content/public/test/test_navigation_throttle.h" @@ -16,6 +15,7 @@ #include "content/test/test_render_frame_host.h" #include "content/test/test_web_contents.h" #include "net/ssl/ssl_connection_status_flags.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" namespace content { @@ -265,7 +265,7 @@ false, // has_user_gesture ui::PAGE_TRANSITION_LINK, false, // is_external_protocol - REQUEST_CONTEXT_TYPE_LOCATION); + blink::mojom::RequestContextType::LOCATION); } private: @@ -343,19 +343,19 @@ // Note: can be extended to cover more internal members. TEST_F(NavigationHandleImplTest, SimpleDataChecksRedirectAndProcess) { SimulateWillStartRequest(); - EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, + EXPECT_EQ(blink::mojom::RequestContextType::LOCATION, test_handle()->request_context_type()); EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, test_handle()->GetConnectionInfo()); SimulateWillRedirectRequest(); - EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, + EXPECT_EQ(blink::mojom::RequestContextType::LOCATION, test_handle()->request_context_type()); EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, test_handle()->GetConnectionInfo()); SimulateWillProcessResponse(); - EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, + EXPECT_EQ(blink::mojom::RequestContextType::LOCATION, test_handle()->request_context_type()); EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC_35, test_handle()->GetConnectionInfo()); @@ -373,13 +373,13 @@ TEST_F(NavigationHandleImplTest, SimpleDataChecksFailure) { SimulateWillStartRequest(); - EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, + EXPECT_EQ(blink::mojom::RequestContextType::LOCATION, test_handle()->request_context_type()); EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, test_handle()->GetConnectionInfo()); SimulateWillFailRequest(net::ERR_CERT_DATE_INVALID); - EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, + EXPECT_EQ(blink::mojom::RequestContextType::LOCATION, test_handle()->request_context_type()); EXPECT_EQ(net::ERR_CERT_DATE_INVALID, test_handle()->GetNetErrorCode()); }
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index bd157dd..4a0b72f 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -53,7 +53,6 @@ #include "content/public/common/content_switches.h" #include "content/public/common/origin_util.h" #include "content/public/common/renderer_preferences.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/url_constants.h" #include "content/public/common/url_utils.h" #include "content/public/common/web_preferences.h" @@ -68,6 +67,7 @@ #include "services/network/public/cpp/resource_response.h" #include "services/network/public/cpp/url_loader_completion_status.h" #include "third_party/blink/public/common/frame/sandbox_flags.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/resource_request_blocked_reason.h" #include "third_party/blink/public/platform/web_mixed_content_context_type.h" #include "url/url_constants.h" @@ -341,7 +341,8 @@ frame_tree_node, common_params, mojom::BeginNavigationParams::New( entry.extra_headers(), net::LOAD_NORMAL, - false /* skip_service_worker */, REQUEST_CONTEXT_TYPE_LOCATION, + false /* skip_service_worker */, + blink::mojom::RequestContextType::LOCATION, blink::WebMixedContentContextType::kBlockable, is_form_submission, GURL() /* searchable_form_url */, std::string() /* searchable_form_encoding */, initiator,
diff --git a/content/browser/loader/cross_site_document_resource_handler_unittest.cc b/content/browser/loader/cross_site_document_resource_handler_unittest.cc index e09e9a1b..78a959f 100644 --- a/content/browser/loader/cross_site_document_resource_handler_unittest.cc +++ b/content/browser/loader/cross_site_document_resource_handler_unittest.cc
@@ -81,7 +81,7 @@ OriginHeader cors_request; // Attributes of the HTTP response. - const char* response_mime_type; + const char* response_content_type; MimeType canonical_mime_type; bool include_no_sniff_header; bool simulate_range_response; @@ -153,24 +153,24 @@ } packets += "}"; - return os << "\n description = " << scenario.description - << "\n target_url = " << scenario.target_url - << "\n resource_type = " << scenario.resource_type - << "\n initiator_origin = " << scenario.initiator_origin - << "\n cors_request = " + return os << "\n description = " << scenario.description + << "\n target_url = " << scenario.target_url + << "\n resource_type = " << scenario.resource_type + << "\n initiator_origin = " << scenario.initiator_origin + << "\n cors_request = " << (scenario.cors_request == OriginHeader::kOmit ? "OriginHeader::kOmit" : "OriginHeader::kInclude") - << "\n response_mime_type = " << scenario.response_mime_type - << "\n canonical_mime_type = " << scenario.canonical_mime_type - << "\n include_no_sniff = " + << "\n response_content_type = " << scenario.response_content_type + << "\n canonical_mime_type = " << scenario.canonical_mime_type + << "\n include_no_sniff = " << (scenario.include_no_sniff_header ? "true" : "false") - << "\n range_response = " + << "\n range_response = " << (scenario.simulate_range_response ? "true" : "false") - << "\n cors_response = " << cors_response - << "\n packets = " << packets - << "\n verdict = " << verdict - << "\n verdict_packet = " << scenario.verdict_packet; + << "\n cors_response = " << cors_response + << "\n packets = " << packets + << "\n verdict = " << verdict + << "\n verdict_packet = " << scenario.verdict_packet; } // An HTML response with an HTML comment that's longer than the sniffing @@ -207,7 +207,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -223,7 +223,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -239,7 +239,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/json", // response_mime_type + "text/json", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -255,7 +255,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "application/javascript", // response_mime_type + "application/javascript", // response_content_type MimeType::kOthers, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -271,7 +271,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -287,7 +287,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "application/rss+xml", // response_mime_type + "application/rss+xml", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -303,7 +303,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "text/json", // response_mime_type + "text/json", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -319,7 +319,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -335,7 +335,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -357,7 +357,7 @@ RESOURCE_TYPE_PLUGIN_RESOURCE, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -373,7 +373,7 @@ RESOURCE_TYPE_PLUGIN_RESOURCE, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -389,7 +389,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "application/javascript", // response_mime_type + "application/javascript", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -405,7 +405,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "application/javascript", // response_mime_type + "application/javascript", // response_content_type MimeType::kOthers, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -421,7 +421,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "image/png", // response_mime_type + "image/png", // response_content_type MimeType::kOthers, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -437,7 +437,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "image/png", // response_mime_type + "image/png", // response_content_type MimeType::kOthers, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -455,7 +455,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -471,7 +471,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -487,7 +487,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -504,7 +504,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/json", // response_mime_type + "text/json", // response_content_type MimeType::kJson, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -520,7 +520,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -536,7 +536,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -553,7 +553,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "application/xml", // response_mime_type + "application/xml", // response_content_type MimeType::kXml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -569,7 +569,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/json", // response_mime_type + "text/json", // response_content_type MimeType::kJson, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -585,7 +585,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -601,7 +601,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -617,7 +617,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -633,7 +633,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -649,7 +649,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kInvalidMimeType, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -667,7 +667,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -683,7 +683,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html; charset=utf-8", // response_mime_type + "text/html; charset=utf-8", // response_content_type MimeType::kHtml, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -699,7 +699,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -715,7 +715,7 @@ RESOURCE_TYPE_XHR, // resource_type "https://bar.site.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -733,7 +733,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://foo.example.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -753,7 +753,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -771,7 +771,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -787,7 +787,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "application/xml", // response_mime_type + "application/xml", // response_content_type MimeType::kXml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -803,7 +803,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "application/json", // response_mime_type + "application/json", // response_content_type MimeType::kJson, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -819,7 +819,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -835,7 +835,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -851,7 +851,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -868,7 +868,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -884,7 +884,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -900,7 +900,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -918,7 +918,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -934,7 +934,7 @@ RESOURCE_TYPE_PLUGIN_RESOURCE, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -950,7 +950,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://c.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/json", // response_mime_type + "text/json", // response_content_type MimeType::kJson, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -966,7 +966,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://c.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "audio/x-wav", // response_mime_type + "audio/x-wav", // response_content_type MimeType::kOthers, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -982,7 +982,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://c.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "application/javascript", // response_mime_type + "application/javascript", // response_content_type MimeType::kOthers, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -998,7 +998,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://c.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -1015,7 +1015,7 @@ RESOURCE_TYPE_SCRIPT, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kInclude, // cors_request - "application/javascript", // response_mime_type + "application/javascript", // response_content_type MimeType::kOthers, // canonical_mime_type true, // include_no_sniff_header false, // simulate_range_response @@ -1031,7 +1031,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -1047,7 +1047,7 @@ RESOURCE_TYPE_XHR, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header false, // simulate_range_response @@ -1063,7 +1063,7 @@ RESOURCE_TYPE_MEDIA, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/plain", // response_mime_type + "text/plain", // response_content_type MimeType::kPlain, // canonical_mime_type false, // include_no_sniff_header true, // simulate_range_response @@ -1079,7 +1079,7 @@ RESOURCE_TYPE_MEDIA, // resource_type "http://www.a.com/", // initiator_origin OriginHeader::kOmit, // cors_request - "text/html", // response_mime_type + "text/html", // response_content_type MimeType::kHtml, // canonical_mime_type false, // include_no_sniff_header true, // simulate_range_response @@ -1186,7 +1186,7 @@ first_handler_ = std::make_unique<MimeSniffingResourceHandler>( std::move(first_handler_), &dispatcher_host_, &plugin_service_, intercepting_handler_.get(), request_.get(), - REQUEST_CONTEXT_TYPE_SCRIPT); + blink::mojom::RequestContextType::SCRIPT); } // Create a mock loader to drive our chain of resource loaders. @@ -1195,7 +1195,7 @@ // Returns a ResourceResponse that matches the TestScenario's parameters. scoped_refptr<network::ResourceResponse> CreateResponse( - const char* response_mime_type, + const char* response_content_type, bool include_no_sniff_header, bool simulate_range_response, AccessControlAllowOriginHeader cors_response, @@ -1208,14 +1208,14 @@ // Content-Type header. std::string charset; - bool had_charset; - std::string boundary; + bool had_charset = false; response_headers->AddHeader(std::string("Content-Type: ") + - response_mime_type); - response->head.mime_type = response_mime_type; - net::HttpUtil::ParseContentType(response_mime_type, + response_content_type); + net::HttpUtil::ParseContentType(response_content_type, &response->head.mime_type, &charset, - &had_charset, &boundary); + &had_charset, nullptr); + EXPECT_FALSE(response->head.mime_type.empty()) + << "Invalid MIME type defined in kScenarios."; // No sniff header. if (include_no_sniff_header) @@ -1330,7 +1330,7 @@ // Set up response based on scenario. scoped_refptr<network::ResourceResponse> response = CreateResponse( - scenario.response_mime_type, scenario.include_no_sniff_header, + scenario.response_content_type, scenario.include_no_sniff_header, scenario.simulate_range_response, scenario.cors_response, scenario.initiator_origin); @@ -1621,7 +1621,7 @@ // Set up response based on scenario. scoped_refptr<network::ResourceResponse> response = CreateResponse( - scenario.response_mime_type, scenario.include_no_sniff_header, + scenario.response_content_type, scenario.include_no_sniff_header, scenario.simulate_range_response, scenario.cors_response, scenario.initiator_origin); @@ -1763,7 +1763,7 @@ // Set up response based on scenario. scoped_refptr<network::ResourceResponse> response = CreateResponse( - scenario.response_mime_type, scenario.include_no_sniff_header, + scenario.response_content_type, scenario.include_no_sniff_header, scenario.simulate_range_response, scenario.cors_response, scenario.initiator_origin);
diff --git a/content/browser/loader/mime_sniffing_resource_handler.cc b/content/browser/loader/mime_sniffing_resource_handler.cc index 74707ef3..b228a7d 100644 --- a/content/browser/loader/mime_sniffing_resource_handler.cc +++ b/content/browser/loader/mime_sniffing_resource_handler.cc
@@ -115,7 +115,7 @@ PluginService* plugin_service, InterceptingResourceHandler* intercepting_handler, net::URLRequest* request, - RequestContextType request_context_type) + blink::mojom::RequestContextType request_context_type) : LayeredResourceHandler(request, std::move(next_handler)), state_(STATE_STARTING), host_(host), @@ -161,7 +161,7 @@ if (!(response_->head.headers.get() && response_->head.headers->response_code() == 304)) { // MIME sniffing should be disabled for a request initiated by fetch(). - if (request_context_type_ != REQUEST_CONTEXT_TYPE_FETCH && + if (request_context_type_ != blink::mojom::RequestContextType::FETCH && network::ShouldSniffContent(request(), response_.get())) { controller->Resume(); return;
diff --git a/content/browser/loader/mime_sniffing_resource_handler.h b/content/browser/loader/mime_sniffing_resource_handler.h index b1223d3..8e85dba3 100644 --- a/content/browser/loader/mime_sniffing_resource_handler.h +++ b/content/browser/loader/mime_sniffing_resource_handler.h
@@ -14,8 +14,8 @@ #include "content/browser/loader/layered_resource_handler.h" #include "content/browser/loader/resource_controller.h" #include "content/common/content_export.h" -#include "content/public/common/request_context_type.h" #include "ppapi/buildflags/buildflags.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" namespace net { class URLRequest; @@ -43,12 +43,13 @@ class CONTENT_EXPORT MimeSniffingResourceHandler : public LayeredResourceHandler { public: - MimeSniffingResourceHandler(std::unique_ptr<ResourceHandler> next_handler, - ResourceDispatcherHostImpl* host, - PluginService* plugin_service, - InterceptingResourceHandler* intercepting_handler, - net::URLRequest* request, - RequestContextType request_context_type); + MimeSniffingResourceHandler( + std::unique_ptr<ResourceHandler> next_handler, + ResourceDispatcherHostImpl* host, + PluginService* plugin_service, + InterceptingResourceHandler* intercepting_handler, + net::URLRequest* request, + blink::mojom::RequestContextType request_context_type); ~MimeSniffingResourceHandler() override; private: @@ -198,7 +199,7 @@ // needed. InterceptingResourceHandler* intercepting_handler_; - RequestContextType request_context_type_; + blink::mojom::RequestContextType request_context_type_; // True if current in an AdvanceState loop. Used to prevent re-entrancy and // avoid an extra PostTask.
diff --git a/content/browser/loader/mime_sniffing_resource_handler_unittest.cc b/content/browser/loader/mime_sniffing_resource_handler_unittest.cc index 6d23266..4a77bb1 100644 --- a/content/browser/loader/mime_sniffing_resource_handler_unittest.cc +++ b/content/browser/loader/mime_sniffing_resource_handler_unittest.cc
@@ -244,7 +244,7 @@ MimeSniffingResourceHandler mime_sniffing_handler( std::move(scoped_test_handler), nullptr, nullptr, nullptr, request, - REQUEST_CONTEXT_TYPE_UNSPECIFIED); + blink::mojom::RequestContextType::UNSPECIFIED); MockResourceLoader mock_loader(&mime_sniffing_handler); EXPECT_EQ(MockResourceLoader::Status::IDLE, @@ -290,7 +290,7 @@ MimeSniffingResourceHandler mime_sniffing_handler( std::unique_ptr<ResourceHandler>(std::move(scoped_test_handler)), &host, &plugin_service, intercepting_handler.get(), request.get(), - REQUEST_CONTEXT_TYPE_UNSPECIFIED); + blink::mojom::RequestContextType::UNSPECIFIED); MockResourceLoader mock_loader(&mime_sniffing_handler); @@ -357,7 +357,7 @@ MimeSniffingResourceHandler mime_sniffing_handler( std::move(scoped_test_handler), &host, &plugin_service, intercepting_handler.get(), request.get(), - REQUEST_CONTEXT_TYPE_UNSPECIFIED); + blink::mojom::RequestContextType::UNSPECIFIED); MockResourceLoader mock_loader(&mime_sniffing_handler); @@ -521,7 +521,7 @@ MimeSniffingResourceHandler mime_sniffing_handler( std::move(scoped_test_handler), &host, &plugin_service, intercepting_handler.get(), request.get(), - REQUEST_CONTEXT_TYPE_UNSPECIFIED); + blink::mojom::RequestContextType::UNSPECIFIED); MockResourceLoader mock_loader(&mime_sniffing_handler); @@ -854,7 +854,7 @@ std::unique_ptr<ResourceHandler>(new TestResourceHandler()), &host, &plugin_service, static_cast<InterceptingResourceHandler*>(intercepting_handler.get()), - request.get(), REQUEST_CONTEXT_TYPE_UNSPECIFIED); + request.get(), blink::mojom::RequestContextType::UNSPECIFIED); MockResourceLoader mock_loader(&mime_sniffing_handler); @@ -907,7 +907,8 @@ scoped_test_handler->set_on_response_started_result(false); MimeSniffingResourceHandler mime_sniffing_handler( std::move(scoped_test_handler), &host, &plugin_service, - intercepting_handler.get(), request.get(), REQUEST_CONTEXT_TYPE_FETCH); + intercepting_handler.get(), request.get(), + blink::mojom::RequestContextType::FETCH); MockResourceLoader mock_loader(&mime_sniffing_handler); @@ -967,7 +968,7 @@ MimeSniffingResourceHandler mime_sniffing_handler( std::move(scoped_test_handler), &host, &plugin_service, intercepting_handler.get(), request.get(), - REQUEST_CONTEXT_TYPE_UNSPECIFIED); + blink::mojom::RequestContextType::UNSPECIFIED); MockResourceLoader mock_loader(&mime_sniffing_handler); @@ -1045,7 +1046,7 @@ MimeSniffingResourceHandler mime_sniffing_handler( std::move(scoped_test_handler), &host, &plugin_service, intercepting_handler.get(), request.get(), - REQUEST_CONTEXT_TYPE_UNSPECIFIED); + blink::mojom::RequestContextType::UNSPECIFIED); MockResourceLoader mock_loader(&mime_sniffing_handler);
diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc index 91f6f32..c86505e 100644 --- a/content/browser/loader/navigation_url_loader_impl.cc +++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -253,7 +253,7 @@ network::mojom::FetchCredentialsMode::kInclude; new_request->fetch_redirect_mode = network::mojom::FetchRedirectMode::kManual; new_request->fetch_request_context_type = - request_info->begin_params->request_context_type; + static_cast<int>(request_info->begin_params->request_context_type); new_request->upgrade_if_insecure = request_info->upgrade_if_insecure; new_request->throttling_profile_id = request_info->devtools_frame_token; return new_request;
diff --git a/content/browser/loader/navigation_url_loader_impl_unittest.cc b/content/browser/loader/navigation_url_loader_impl_unittest.cc index 37cf04d..e40e843a 100644 --- a/content/browser/loader/navigation_url_loader_impl_unittest.cc +++ b/content/browser/loader/navigation_url_loader_impl_unittest.cc
@@ -163,7 +163,7 @@ mojom::BeginNavigationParamsPtr begin_params = mojom::BeginNavigationParams::New( headers, net::LOAD_NORMAL, false /* skip_service_worker */, - REQUEST_CONTEXT_TYPE_LOCATION, + blink::mojom::RequestContextType::LOCATION, blink::WebMixedContentContextType::kBlockable, false /* is_form_submission */, GURL() /* searchable_form_url */, std::string() /* searchable_form_encoding */,
diff --git a/content/browser/loader/navigation_url_loader_unittest.cc b/content/browser/loader/navigation_url_loader_unittest.cc index 75f70ba..7a7eb768 100644 --- a/content/browser/loader/navigation_url_loader_unittest.cc +++ b/content/browser/loader/navigation_url_loader_unittest.cc
@@ -83,7 +83,8 @@ mojom::BeginNavigationParamsPtr begin_params = mojom::BeginNavigationParams::New( std::string() /* headers */, net::LOAD_NORMAL, - false /* skip_service_worker */, REQUEST_CONTEXT_TYPE_LOCATION, + false /* skip_service_worker */, + blink::mojom::RequestContextType::LOCATION, blink::WebMixedContentContextType::kBlockable, false /* is_form_submission */, GURL() /* searchable_form_url */, std::string() /* searchable_form_encoding */,
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc index 2ed617d..58e1e1a 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1019,7 +1019,8 @@ request_data.fetch_credentials_mode, request_data.fetch_redirect_mode, request_data.fetch_integrity, request_data.keepalive, static_cast<ResourceType>(request_data.resource_type), - static_cast<RequestContextType>(request_data.fetch_request_context_type), + static_cast<blink::mojom::RequestContextType>( + request_data.fetch_request_context_type), request_data.fetch_frame_type, request_data.request_body); // Have the appcache associate its extra info with the request. @@ -1038,7 +1039,8 @@ RecordFetchRequestMode(request_data.url, request_data.method, request_data.fetch_request_mode); const bool is_initiated_by_fetch_api = - request_data.fetch_request_context_type == REQUEST_CONTEXT_TYPE_FETCH; + request_data.fetch_request_context_type == + static_cast<int>(blink::mojom::RequestContextType::FETCH); BeginRequestInternal(std::move(new_request), std::move(handler), is_initiated_by_fetch_api, std::move(throttling_token)); @@ -1078,7 +1080,8 @@ return AddStandardHandlers( request, static_cast<ResourceType>(request_data.resource_type), resource_context, request_data.fetch_request_mode, - static_cast<RequestContextType>(request_data.fetch_request_context_type), + static_cast<blink::mojom::RequestContextType>( + request_data.fetch_request_context_type), url_loader_options, requester_info->appcache_service(), child_id, route_id, std::move(handler)); } @@ -1089,7 +1092,7 @@ ResourceType resource_type, ResourceContext* resource_context, network::mojom::FetchRequestMode fetch_request_mode, - RequestContextType fetch_request_context_type, + blink::mojom::RequestContextType fetch_request_context_type, uint32_t url_loader_options, AppCacheService* appcache_service, int child_id,
diff --git a/content/browser/loader/resource_dispatcher_host_impl.h b/content/browser/loader/resource_dispatcher_host_impl.h index ec89329..0aec4755 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.h +++ b/content/browser/loader/resource_dispatcher_host_impl.h
@@ -37,13 +37,13 @@ #include "content/public/browser/resource_request_info.h" #include "content/public/browser/stream_handle.h" #include "content/public/common/previews_state.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "net/base/load_states.h" #include "net/base/request_priority.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/keepalive_statistics_recorder.h" #include "services/network/public/mojom/url_loader.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "url/gurl.h" namespace base { @@ -596,7 +596,7 @@ ResourceType resource_type, ResourceContext* resource_context, network::mojom::FetchRequestMode fetch_request_mode, - RequestContextType fetch_request_context_type, + blink::mojom::RequestContextType fetch_request_context_type, uint32_t url_loader_options, AppCacheService* appcache_service, int child_id,
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc index da5157e..7b6f1bb9 100644 --- a/content/browser/loader/resource_dispatcher_host_unittest.cc +++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -808,7 +808,8 @@ mojom::BeginNavigationParamsPtr begin_params = mojom::BeginNavigationParams::New( std::string() /* headers */, net::LOAD_NORMAL, - false /* skip_service_worker */, REQUEST_CONTEXT_TYPE_LOCATION, + false /* skip_service_worker */, + blink::mojom::RequestContextType::LOCATION, blink::WebMixedContentContextType::kBlockable, false /* is_form_submission */, GURL() /* searchable_form_url */, std::string() /* searchable_form_encoding */,
diff --git a/content/browser/browser_side_navigation_browsertest.cc b/content/browser/navigation_browsertest.cc similarity index 92% rename from content/browser/browser_side_navigation_browsertest.cc rename to content/browser/navigation_browsertest.cc index 852370d..01834d0 100644 --- a/content/browser/browser_side_navigation_browsertest.cc +++ b/content/browser/navigation_browsertest.cc
@@ -138,31 +138,27 @@ } // namespace -// Test with BrowserSideNavigation enabled (aka PlzNavigate). +// Test about navigation. // If you don't need a custom embedded test server, please use the next class -// below (BrowserSideNavigationBrowserTest), it will automatically start the +// below (NavigationBrowserTest), it will automatically start the // default server. -// TODO(clamy): Rename those NavigationBrowserTests. -class BrowserSideNavigationBaseBrowserTest : public ContentBrowserTest { +class NavigationBaseBrowserTest : public ContentBrowserTest { protected: void SetUpOnMainThread() override { host_resolver()->AddRule("*", "127.0.0.1"); } }; -class BrowserSideNavigationBrowserTest - : public BrowserSideNavigationBaseBrowserTest { +class NavigationBrowserTest : public NavigationBaseBrowserTest { protected: void SetUpOnMainThread() override { - BrowserSideNavigationBaseBrowserTest::SetUpOnMainThread(); + NavigationBaseBrowserTest::SetUpOnMainThread(); ASSERT_TRUE(embedded_test_server()->Start()); } }; -// Ensure that browser initiated basic navigations work with browser side -// navigation. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, - BrowserInitiatedNavigations) { +// Ensure that browser initiated basic navigations work. +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, BrowserInitiatedNavigations) { // Perform a navigation with no live renderer. { TestNavigationObserver observer(shell()->web_contents()); @@ -174,7 +170,9 @@ RenderFrameHost* initial_rfh = static_cast<WebContentsImpl*>(shell()->web_contents()) - ->GetFrameTree()->root()->current_frame_host(); + ->GetFrameTree() + ->root() + ->current_frame_host(); // Perform a same site navigation. { @@ -187,7 +185,9 @@ // The RenderFrameHost should not have changed. EXPECT_EQ(initial_rfh, static_cast<WebContentsImpl*>(shell()->web_contents()) - ->GetFrameTree()->root()->current_frame_host()); + ->GetFrameTree() + ->root() + ->current_frame_host()); // Perform a cross-site navigation. { @@ -200,12 +200,13 @@ // The RenderFrameHost should have changed. EXPECT_NE(initial_rfh, static_cast<WebContentsImpl*>(shell()->web_contents()) - ->GetFrameTree()->root()->current_frame_host()); + ->GetFrameTree() + ->root() + ->current_frame_host()); } -// Ensure that renderer initiated same-site navigations work with browser side -// navigation. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, +// Ensure that renderer initiated same-site navigations work. +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, RendererInitiatedSameSiteNavigation) { // Perform a navigation with no live renderer. { @@ -218,7 +219,9 @@ RenderFrameHost* initial_rfh = static_cast<WebContentsImpl*>(shell()->web_contents()) - ->GetFrameTree()->root()->current_frame_host(); + ->GetFrameTree() + ->root() + ->current_frame_host(); // Simulate clicking on a same-site link. { @@ -236,12 +239,13 @@ // The RenderFrameHost should not have changed. EXPECT_EQ(initial_rfh, static_cast<WebContentsImpl*>(shell()->web_contents()) - ->GetFrameTree()->root()->current_frame_host()); + ->GetFrameTree() + ->root() + ->current_frame_host()); } -// Ensure that renderer initiated cross-site navigations work with browser side -// navigation. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, +// Ensure that renderer initiated cross-site navigations work. +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, RendererInitiatedCrossSiteNavigation) { // Perform a navigation with no live renderer. { @@ -254,13 +258,15 @@ RenderFrameHost* initial_rfh = static_cast<WebContentsImpl*>(shell()->web_contents()) - ->GetFrameTree()->root()->current_frame_host(); + ->GetFrameTree() + ->root() + ->current_frame_host(); // Simulate clicking on a cross-site link. { TestNavigationObserver observer(shell()->web_contents()); const char kReplacePortNumber[] = - "window.domAutomationController.send(setPortNumber(%d));"; + "window.domAutomationController.send(setPortNumber(%d));"; uint16_t port_number = embedded_test_server()->port(); GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); bool success = false; @@ -294,8 +300,8 @@ } } -// Ensure that browser side navigation handles navigation failures. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, FailedNavigation) { +// Ensure navigation failures are handled. +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, FailedNavigation) { // Perform a navigation with no live renderer. { TestNavigationObserver observer(shell()->web_contents()); @@ -320,9 +326,8 @@ } } -// Ensure that browser side navigation can load browser initiated navigations -// to view-source URLs. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, +// Ensure that browser initiated navigations to view-source URLs works. +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, ViewSourceNavigation_BrowserInitiated) { TestNavigationObserver observer(shell()->web_contents()); GURL url(embedded_test_server()->GetURL("/title1.html")); @@ -333,9 +338,8 @@ EXPECT_TRUE(observer.last_navigation_succeeded()); } -// Ensure that browser side navigation blocks content initiated navigations to -// view-source URLs. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, +// Ensure that content initiated navigations to view-sources URLs are blocked. +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, ViewSourceNavigation_RendererInitiated) { TestNavigationObserver observer(shell()->web_contents()); GURL kUrl(embedded_test_server()->GetURL("/simple_links.html")); @@ -366,21 +370,20 @@ // Ensure that closing a page by running its beforeunload handler doesn't hang // if there's an ongoing navigation. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, - UnloadDuringNavigation) { +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, UnloadDuringNavigation) { content::WindowedNotificationObserver close_observer( content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::Source<content::WebContents>(shell()->web_contents())); GURL url("chrome://resources/css/tabs.css"); NavigationHandleObserver handle_observer(shell()->web_contents(), url); shell()->LoadURL(url); - shell()->web_contents()->DispatchBeforeUnload(); + shell()->web_contents()->DispatchBeforeUnload(false /* auto_cancel */); close_observer.Wait(); EXPECT_EQ(net::ERR_ABORTED, handle_observer.net_error_code()); } // Ensure that the referrer of a navigation is properly sanitized. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, SanitizeReferrer) { +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, SanitizeReferrer) { const GURL kInsecureUrl(embedded_test_server()->GetURL("/title1.html")); const Referrer kSecureReferrer( GURL("https://secure-url.com"), @@ -412,8 +415,7 @@ // Test to verify that an exploited renderer process trying to upload a file // it hasn't been explicitly granted permissions to is correctly terminated. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, - PostUploadIllegalFilePath) { +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, PostUploadIllegalFilePath) { GURL form_url( embedded_test_server()->GetURL("/form_that_posts_to_echoall.html")); EXPECT_TRUE(NavigateToURL(shell(), form_url)); @@ -475,7 +477,7 @@ // based on Blink's state instead of the history state in the browser process, // which ends up loading the originally blocked URL. With PlzNavigate, the // reload uses the NavigationEntry state to create a navigation and commit it. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, VerifyBlockedErrorPageURL_Reload) { NavigationControllerImpl& controller = static_cast<NavigationControllerImpl&>( shell()->web_contents()->GetController()); @@ -507,17 +509,16 @@ controller.GetLastCommittedEntry()->GetVirtualURL()); } -class BrowserSideNavigationBrowserDisableWebSecurityTest - : public BrowserSideNavigationBrowserTest { +class NavigationDisableWebSecurityTest : public NavigationBrowserTest { public: - BrowserSideNavigationBrowserDisableWebSecurityTest() {} + NavigationDisableWebSecurityTest() {} protected: void SetUpCommandLine(base::CommandLine* command_line) override { // Simulate a compromised renderer, otherwise the cross-origin request to // file: is blocked. command_line->AppendSwitch(switches::kDisableWebSecurity); - BrowserSideNavigationBrowserTest::SetUpCommandLine(command_line); + NavigationBrowserTest::SetUpCommandLine(command_line); } }; @@ -527,7 +528,7 @@ // TODO(nasko): This test case belongs better in // security_exploit_browsertest.cc, so move it there once PlzNavigate is on // by default. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserDisableWebSecurityTest, +IN_PROC_BROWSER_TEST_F(NavigationDisableWebSecurityTest, ValidateBaseUrlForDataUrl) { GURL start_url(embedded_test_server()->GetURL("/title1.html")); EXPECT_TRUE(NavigateToURL(shell(), start_url)); @@ -564,7 +565,8 @@ mojom::BeginNavigationParamsPtr begin_params = mojom::BeginNavigationParams::New( std::string() /* headers */, net::LOAD_NORMAL, - false /* skip_service_worker */, REQUEST_CONTEXT_TYPE_LOCATION, + false /* skip_service_worker */, + blink::mojom::RequestContextType::LOCATION, blink::WebMixedContentContextType::kBlockable, false /* is_form_submission */, GURL() /* searchable_form_url */, std::string() /* searchable_form_encoding */, @@ -610,7 +612,7 @@ EXPECT_TRUE(result.empty()); } -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, BackFollowedByReload) { +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, BackFollowedByReload) { // First, make two history entries. GURL url1(embedded_test_server()->GetURL("/title1.html")); GURL url2(embedded_test_server()->GetURL("/title2.html")); @@ -630,7 +632,7 @@ // Test that a navigation response can be entirely fetched, even after the // NavigationURLLoader has been deleted. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBaseBrowserTest, +IN_PROC_BROWSER_TEST_F(NavigationBaseBrowserTest, FetchResponseAfterNavigationURLLoaderDeleted) { net::test_server::ControllableHttpResponse response(embedded_test_server(), "/main_document"); @@ -678,11 +680,11 @@ } // Navigation are started in the browser process. After the headers are -// received, the URLLoaderClient is transfered from the browser process to the +// received, the URLLoaderClient is transferred from the browser process to the // renderer process. This test ensures that when the the URLLoader is deleted // (in the browser process), the URLLoaderClient (in the renderer process) stops // properly. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBaseBrowserTest, +IN_PROC_BROWSER_TEST_F(NavigationBaseBrowserTest, CancelRequestAfterReadyToCommit) { // This test cancels the request using the ResourceDispatchHost. With the // NetworkService, it is not used so the request is not canceled. @@ -737,8 +739,7 @@ // Data URLs can have a reference fragment like any other URLs. This test makes // sure it is taken into account. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, - DataURLWithReferenceFragment) { +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, DataURLWithReferenceFragment) { GURL url("data:text/html,body#foo"); EXPECT_TRUE(NavigateToURL(shell(), url)); @@ -762,7 +763,7 @@ // 1) Start on a document with history.length == 1. // 2) Create an iframe and call history.pushState at the same time. // 3) history.back() must work. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, IframeAndPushStateSimultaneously) { GURL main_url = embedded_test_server()->GetURL("/simple_page.html"); GURL iframe_url = embedded_test_server()->GetURL("/hello.html"); @@ -809,7 +810,7 @@ // Regression test for https://crbug.com/260144 // Back/Forward navigation in an iframe must not stop ongoing XHR. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBaseBrowserTest, +IN_PROC_BROWSER_TEST_F(NavigationBaseBrowserTest, IframeNavigationsDoNotStopXHR) { // A response for the XHR request. It will be delayed until the end of all the // navigations. @@ -898,7 +899,7 @@ } // Regression test for https://crbug.com/856396. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBaseBrowserTest, +IN_PROC_BROWSER_TEST_F(NavigationBaseBrowserTest, ReplacingDocumentLoaderFiresLoadEvent) { net::test_server::ControllableHttpResponse main_document_response( embedded_test_server(), "/main_document"); @@ -952,11 +953,10 @@ } } -class NavigationDownloadBrowserTest - : public BrowserSideNavigationBaseBrowserTest { +class NavigationDownloadBrowserTest : public NavigationBaseBrowserTest { protected: void SetUpOnMainThread() override { - BrowserSideNavigationBaseBrowserTest::SetUpOnMainThread(); + NavigationBaseBrowserTest::SetUpOnMainThread(); // Set up a test download directory, in order to prevent prompting for // handling downloads. @@ -1028,7 +1028,7 @@ // 4) The browser gets notified of the commit of the first navigation. This // should not destroy the NavigationRequest corresponding to the second // navigation. -IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, +IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, RaceNewNavigationCommitWhileOldOneFinishesLoading) { // Start the test with an initial document. GURL main_url(embedded_test_server()->GetURL("/simple_page.html"));
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 2a64c77..ec04477 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -127,6 +127,10 @@ #include "ui/wm/core/ime_util_chromeos.h" #endif +#if defined(OS_FUCHSIA) +#include "ui/base/ime/input_method_keyboard_controller.h" +#endif + using gfx::RectToSkIRect; using gfx::SkIRectToRect; @@ -1509,12 +1513,6 @@ //////////////////////////////////////////////////////////////////////////////// // RenderWidgetHostViewAura, display::DisplayObserver implementation: -void RenderWidgetHostViewAura::OnDisplayAdded( - const display::Display& new_display) {} - -void RenderWidgetHostViewAura::OnDisplayRemoved( - const display::Display& old_display) {} - void RenderWidgetHostViewAura::OnDisplayMetricsChanged( const display::Display& display, uint32_t metrics) { @@ -1743,6 +1741,13 @@ ->DismissVirtualKeyboard(); } } +#elif defined(OS_FUCHSIA) + if (!editable && window_) { + if (input_method) { + input_method->GetInputMethodKeyboardController() + ->DismissVirtualKeyboard(); + } + } #endif } @@ -2401,7 +2406,7 @@ if (state && state->type != ui::TEXT_INPUT_TYPE_NONE && state->mode != ui::TEXT_INPUT_MODE_NONE) { bool show_virtual_keyboard = true; -#if defined(OS_WIN) +#if defined(OS_WIN) || defined(OS_FUCHSIA) show_virtual_keyboard = last_pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH; #endif
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index d930d55..07327abc 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -246,8 +246,6 @@ bool ShouldDoLearning() override; // Overridden from display::DisplayObserver: - void OnDisplayAdded(const display::Display& new_display) override; - void OnDisplayRemoved(const display::Display& old_display) override; void OnDisplayMetricsChanged(const display::Display& display, uint32_t metrics) override;
diff --git a/content/browser/service_worker/service_worker_context_request_handler_unittest.cc b/content/browser/service_worker/service_worker_context_request_handler_unittest.cc index 661fb389..086d992 100644 --- a/content/browser/service_worker/service_worker_context_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_context_request_handler_unittest.cc
@@ -131,7 +131,8 @@ network::mojom::FetchCredentialsMode::kOmit, network::mojom::FetchRedirectMode::kFollow, std::string() /* integrity */, false /* keepalive */, - RESOURCE_TYPE_SERVICE_WORKER, REQUEST_CONTEXT_TYPE_SERVICE_WORKER, + RESOURCE_TYPE_SERVICE_WORKER, + blink::mojom::RequestContextType::SERVICE_WORKER, network::mojom::RequestContextFrameType::kNone, nullptr); } @@ -308,7 +309,7 @@ network::mojom::FetchCredentialsMode::kOmit, network::mojom::FetchRedirectMode::kFollow, std::string() /* integrity */, false /* keepalive */, RESOURCE_TYPE_SERVICE_WORKER, - REQUEST_CONTEXT_TYPE_SERVICE_WORKER, + blink::mojom::RequestContextType::SERVICE_WORKER, network::mojom::RequestContextFrameType::kNone, nullptr); // Verify a ServiceWorkerRequestHandler was created. ServiceWorkerRequestHandler* handler =
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.cc b/content/browser/service_worker/service_worker_controllee_request_handler.cc index 77ab17a4..f2814a2 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler.cc
@@ -148,7 +148,7 @@ const std::string& integrity, bool keepalive, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, scoped_refptr<network::ResourceRequestBody> body) : ServiceWorkerRequestHandler(std::move(context),
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.h b/content/browser/service_worker/service_worker_controllee_request_handler.h index a63f1f5c..d8ed84c 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler.h +++ b/content/browser/service_worker/service_worker_controllee_request_handler.h
@@ -19,10 +19,10 @@ #include "content/browser/service_worker/service_worker_url_job_wrapper.h" #include "content/browser/service_worker/service_worker_url_request_job.h" #include "content/common/service_worker/service_worker_types.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "services/network/public/mojom/fetch_api.mojom.h" #include "services/network/public/mojom/request_context_frame_type.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "url/gurl.h" namespace net { @@ -58,7 +58,7 @@ const std::string& integrity, bool keepalive, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, scoped_refptr<network::ResourceRequestBody> body); ~ServiceWorkerControlleeRequestHandler() override; @@ -158,7 +158,7 @@ network::mojom::FetchRedirectMode redirect_mode_; std::string integrity_; const bool keepalive_; - RequestContextType request_context_type_; + blink::mojom::RequestContextType request_context_type_; network::mojom::RequestContextFrameType frame_type_; scoped_refptr<network::ResourceRequestBody> body_; ResourceContext* resource_context_;
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc index 581d57c..e929e0d 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
@@ -23,7 +23,6 @@ #include "content/common/service_worker/service_worker_types.h" #include "content/common/service_worker/service_worker_utils.h" #include "content/public/browser/resource_context.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "content/public/test/mock_resource_context.h" #include "content/public/test/test_browser_thread_bundle.h" @@ -36,6 +35,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" namespace content { namespace service_worker_controllee_request_handler_unittest { @@ -70,7 +70,7 @@ std::string() /* integrity */, false /* keepalive */, type, - REQUEST_CONTEXT_TYPE_HYPERLINK, + blink::mojom::RequestContextType::HYPERLINK, network::mojom::RequestContextFrameType::kTopLevel, scoped_refptr<network::ResourceRequestBody>())), job_(nullptr) {}
diff --git a/content/browser/service_worker/service_worker_data_pipe_reader_unittest.cc b/content/browser/service_worker/service_worker_data_pipe_reader_unittest.cc index f279d09..dfe7d9f 100644 --- a/content/browser/service_worker/service_worker_data_pipe_reader_unittest.cc +++ b/content/browser/service_worker/service_worker_data_pipe_reader_unittest.cc
@@ -42,7 +42,7 @@ std::string() /* integrity */, false /* keepalive */, RESOURCE_TYPE_MAIN_FRAME, - REQUEST_CONTEXT_TYPE_HYPERLINK, + blink::mojom::RequestContextType::HYPERLINK, network::mojom::RequestContextFrameType::kTopLevel, scoped_refptr<network::ResourceRequestBody>(), delegate),
diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc index d8eea1e3..feaeaea 100644 --- a/content/browser/service_worker/service_worker_provider_host.cc +++ b/content/browser/service_worker/service_worker_provider_host.cc
@@ -642,7 +642,7 @@ const std::string& integrity, bool keepalive, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, base::WeakPtr<storage::BlobStorageContext> blob_storage_context, scoped_refptr<network::ResourceRequestBody> body,
diff --git a/content/browser/service_worker/service_worker_provider_host.h b/content/browser/service_worker/service_worker_provider_host.h index d1ca2a44..9a950be 100644 --- a/content/browser/service_worker/service_worker_provider_host.h +++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -25,7 +25,6 @@ #include "content/common/service_worker/service_worker_container.mojom.h" #include "content/common/service_worker/service_worker_provider.mojom.h" #include "content/common/service_worker/service_worker_types.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/binding.h" @@ -34,6 +33,7 @@ #include "services/network/public/mojom/request_context_frame_type.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_provider_type.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_feature.mojom.h" namespace network { @@ -326,7 +326,7 @@ const std::string& integrity, bool keepalive, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, base::WeakPtr<storage::BlobStorageContext> blob_storage_context, scoped_refptr<network::ResourceRequestBody> body,
diff --git a/content/browser/service_worker/service_worker_request_handler.cc b/content/browser/service_worker/service_worker_request_handler.cc index e72645e4..e98233ef 100644 --- a/content/browser/service_worker/service_worker_request_handler.cc +++ b/content/browser/service_worker/service_worker_request_handler.cc
@@ -78,7 +78,7 @@ storage::BlobStorageContext* blob_storage_context, bool skip_service_worker, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, bool is_parent_frame_secure, scoped_refptr<network::ResourceRequestBody> body, @@ -142,7 +142,7 @@ storage::BlobStorageContext* blob_storage_context, bool skip_service_worker, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, bool is_parent_frame_secure, scoped_refptr<network::ResourceRequestBody> body, @@ -203,7 +203,8 @@ resource_request.fetch_credentials_mode, resource_request.fetch_redirect_mode, resource_request.fetch_integrity, resource_request.keepalive, - RESOURCE_TYPE_SHARED_WORKER, REQUEST_CONTEXT_TYPE_SHARED_WORKER, + RESOURCE_TYPE_SHARED_WORKER, + blink::mojom::RequestContextType::SHARED_WORKER, resource_request.fetch_frame_type, nullptr /* blob_storage_context: unused in S13n */, resource_request.request_body, resource_request.skip_service_worker)); @@ -225,7 +226,7 @@ const std::string& integrity, bool keepalive, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, scoped_refptr<network::ResourceRequestBody> body) { // S13nServiceWorker enabled, NetworkService disabled:
diff --git a/content/browser/service_worker/service_worker_request_handler.h b/content/browser/service_worker/service_worker_request_handler.h index 41132905..39b0470 100644 --- a/content/browser/service_worker/service_worker_request_handler.h +++ b/content/browser/service_worker/service_worker_request_handler.h
@@ -15,12 +15,12 @@ #include "content/browser/loader/navigation_loader_interceptor.h" #include "content/common/content_export.h" #include "content/common/service_worker/service_worker_types.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "net/url_request/url_request_job_factory.h" #include "services/network/public/mojom/fetch_api.mojom.h" #include "services/network/public/mojom/request_context_frame_type.mojom.h" #include "third_party/blink/public/common/service_worker/service_worker_status_code.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" namespace net { class NetworkDelegate; @@ -60,7 +60,7 @@ storage::BlobStorageContext* blob_storage_context, bool skip_service_worker, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, bool is_parent_frame_secure, scoped_refptr<network::ResourceRequestBody> body, @@ -77,7 +77,7 @@ storage::BlobStorageContext* blob_storage_context, bool skip_service_worker, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, bool is_parent_frame_secure, scoped_refptr<network::ResourceRequestBody> body, @@ -106,7 +106,7 @@ const std::string& integrity, bool keepalive, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, scoped_refptr<network::ResourceRequestBody> body);
diff --git a/content/browser/service_worker/service_worker_request_handler_unittest.cc b/content/browser/service_worker/service_worker_request_handler_unittest.cc index 2aaa2c7..16f45aaa 100644 --- a/content/browser/service_worker/service_worker_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_request_handler_unittest.cc
@@ -14,7 +14,6 @@ #include "content/browser/service_worker/service_worker_provider_host.h" #include "content/browser/service_worker/service_worker_test_utils.h" #include "content/common/service_worker/service_worker_utils.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "content/public/test/test_browser_thread_bundle.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" @@ -26,6 +25,7 @@ #include "storage/browser/blob/blob_storage_context.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/service_worker/service_worker_utils.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" namespace content { namespace service_worker_request_handler_unittest { @@ -101,7 +101,7 @@ network::mojom::FetchCredentialsMode::kOmit, network::mojom::FetchRedirectMode::kFollow, std::string() /* integrity */, false /* keepalive */, resource_type, - REQUEST_CONTEXT_TYPE_HYPERLINK, + blink::mojom::RequestContextType::HYPERLINK, network::mojom::RequestContextFrameType::kTopLevel, nullptr); } @@ -155,7 +155,7 @@ ServiceWorkerRequestHandler::InitializeForNavigation( request.get(), navigation_handle_core.get(), &blob_storage_context_, false /* skip_service_worker */, RESOURCE_TYPE_MAIN_FRAME, - REQUEST_CONTEXT_TYPE_HYPERLINK, + blink::mojom::RequestContextType::HYPERLINK, network::mojom::RequestContextFrameType::kTopLevel, true /* is_parent_frame_secure */, nullptr /* body */, base::RepeatingCallback<WebContents*(void)>()); @@ -172,7 +172,7 @@ GURL(url), nullptr /* resource_context */, navigation_handle_core.get(), &blob_storage_context_, false /* skip_service_worker */, RESOURCE_TYPE_MAIN_FRAME, - REQUEST_CONTEXT_TYPE_HYPERLINK, + blink::mojom::RequestContextType::HYPERLINK, network::mojom::RequestContextFrameType::kTopLevel, true /* is_parent_frame_secure */, nullptr /* body */, base::RepeatingCallback<WebContents*(void)>());
diff --git a/content/browser/service_worker/service_worker_url_request_job.cc b/content/browser/service_worker/service_worker_url_request_job.cc index 033f55cb..07fd61481 100644 --- a/content/browser/service_worker/service_worker_url_request_job.cc +++ b/content/browser/service_worker/service_worker_url_request_job.cc
@@ -321,7 +321,7 @@ const std::string& integrity, bool keepalive, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, scoped_refptr<network::ResourceRequestBody> body, Delegate* delegate) @@ -569,7 +569,7 @@ request->fetch_credentials_mode = credentials_mode_; request->load_flags = request_->load_flags(); request->fetch_redirect_mode = redirect_mode_; - request->fetch_request_context_type = request_context_type_; + request->fetch_request_context_type = static_cast<int>(request_context_type_); request->fetch_frame_type = frame_type_; const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); if (info)
diff --git a/content/browser/service_worker/service_worker_url_request_job.h b/content/browser/service_worker/service_worker_url_request_job.h index ea2182b..a402e5a0 100644 --- a/content/browser/service_worker/service_worker_url_request_job.h +++ b/content/browser/service_worker/service_worker_url_request_job.h
@@ -24,7 +24,6 @@ #include "content/browser/service_worker/service_worker_url_job_wrapper.h" #include "content/common/content_export.h" #include "content/common/service_worker/service_worker.mojom.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "mojo/public/cpp/system/data_pipe.h" #include "net/http/http_byte_range.h" @@ -37,6 +36,7 @@ #include "storage/common/blob_storage/blob_storage_constants.h" #include "third_party/blink/public/common/service_worker/service_worker_status_code.h" #include "third_party/blink/public/mojom/fetch/fetch_api_response.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "url/gurl.h" namespace net { @@ -86,7 +86,7 @@ const std::string& integrity, bool keepalive, ResourceType resource_type, - RequestContextType request_context_type, + blink::mojom::RequestContextType request_context_type, network::mojom::RequestContextFrameType frame_type, scoped_refptr<network::ResourceRequestBody> body, Delegate* delegate); @@ -322,7 +322,7 @@ std::string integrity_; const bool keepalive_; const ResourceType resource_type_; - RequestContextType request_context_type_; + blink::mojom::RequestContextType request_context_type_; network::mojom::RequestContextFrameType frame_type_; bool fall_back_required_; // ResourceRequestBody has a collection of BlobDataHandles attached to it
diff --git a/content/browser/service_worker/service_worker_url_request_job_unittest.cc b/content/browser/service_worker/service_worker_url_request_job_unittest.cc index 47a956d..0f7bd63 100644 --- a/content/browser/service_worker/service_worker_url_request_job_unittest.cc +++ b/content/browser/service_worker/service_worker_url_request_job_unittest.cc
@@ -35,7 +35,6 @@ #include "content/common/service_worker/service_worker_utils.h" #include "content/public/browser/blob_handle.h" #include "content/public/common/browser_side_navigation_policy.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "content/public/test/mock_resource_context.h" #include "content/public/test/test_browser_context.h" @@ -66,6 +65,7 @@ #include "third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" namespace content { namespace service_worker_url_request_job_unittest { @@ -121,7 +121,7 @@ network::mojom::FetchCredentialsMode::kOmit, network::mojom::FetchRedirectMode::kFollow, std::string() /* integrity */, false /* keepalive */, resource_type_, - REQUEST_CONTEXT_TYPE_HYPERLINK, + blink::mojom::RequestContextType::HYPERLINK, network::mojom::RequestContextFrameType::kTopLevel, scoped_refptr<network::ResourceRequestBody>(), delegate_); if (simulate_navigation_preload_) {
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc b/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc index ea969ba5..db5b377 100644 --- a/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc +++ b/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc
@@ -323,7 +323,8 @@ network::mojom::FetchCredentialsMode::kOmit, network::mojom::FetchRedirectMode::kFollow, std::string() /* integrity */, false /* keepalive */, - RESOURCE_TYPE_SERVICE_WORKER, REQUEST_CONTEXT_TYPE_SERVICE_WORKER, + RESOURCE_TYPE_SERVICE_WORKER, + blink::mojom::RequestContextType::SERVICE_WORKER, network::mojom::RequestContextFrameType::kNone, scoped_refptr<network::ResourceRequestBody>()); }
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 386454d..0365df2a 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1733,9 +1733,11 @@ true /* check_subframes_only */); } -void WebContentsImpl::DispatchBeforeUnload() { - GetMainFrame()->DispatchBeforeUnload( - RenderFrameHostImpl::BeforeUnloadType::TAB_CLOSE, false); +void WebContentsImpl::DispatchBeforeUnload(bool auto_cancel) { + auto before_unload_type = + auto_cancel ? RenderFrameHostImpl::BeforeUnloadType::DISCARD + : RenderFrameHostImpl::BeforeUnloadType::TAB_CLOSE; + GetMainFrame()->DispatchBeforeUnload(before_unload_type, false); } void WebContentsImpl::AttachToOuterWebContentsFrame( @@ -5965,7 +5967,7 @@ bool proceed, const base::TimeTicks& proceed_time, bool* proceed_to_fire_unload) { for (auto& observer : observers_) - observer.BeforeUnloadFired(proceed_time); + observer.BeforeUnloadFired(proceed, proceed_time); if (delegate_) delegate_->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); // Note: |this| might be deleted at this point.
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 0b8df04..f0ab46b 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -356,7 +356,7 @@ void WasOccluded() override; Visibility GetVisibility() const override; bool NeedToFireBeforeUnload() override; - void DispatchBeforeUnload() override; + void DispatchBeforeUnload(bool auto_cancel) override; void AttachToOuterWebContentsFrame( WebContents* outer_web_contents, RenderFrameHost* outer_contents_frame) override;
diff --git a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc index aaeaa1a..48785fa9 100644 --- a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc +++ b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
@@ -704,7 +704,7 @@ // TODO(crbug.com/848330) Flaky on all platforms IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, - DISABLE_SrcObjectReplaceInactiveTracks) { + DISABLED_SrcObjectReplaceInactiveTracks) { ASSERT_TRUE(embedded_test_server()->Start()); GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); NavigateToURL(shell(), url);
diff --git a/content/common/content_param_traits.cc b/content/common/content_param_traits.cc index 1fe5895..07d1dac 100644 --- a/content/common/content_param_traits.cc +++ b/content/common/content_param_traits.cc
@@ -18,7 +18,7 @@ #include "net/base/ip_endpoint.h" #include "third_party/blink/public/common/messaging/message_port_channel.h" #include "third_party/blink/public/common/messaging/transferable_message.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom.h" +#include "third_party/blink/public/mojom/messaging/transferable_message.mojom.h" #include "ui/accessibility/ax_mode.h" #include "ui/base/ui_base_features.h" #include "ui/events/blink/web_input_event_traits.h"
diff --git a/content/common/content_param_traits_macros.h b/content/common/content_param_traits_macros.h index aaddd3e..f9bbe75 100644 --- a/content/common/content_param_traits_macros.h +++ b/content/common/content_param_traits_macros.h
@@ -14,10 +14,10 @@ #include "content/common/download/mhtml_save_status.h" #include "content/common/render_widget_surface_properties.h" #include "content/public/common/input_event_ack_state.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "ipc/ipc_message_macros.h" #include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_content_security_policy.h" #include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/public/web/web_ime_text_span.h" @@ -30,8 +30,8 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::InputEventAckState, content::INPUT_EVENT_ACK_STATE_MAX) -IPC_ENUM_TRAITS_MAX_VALUE(content::RequestContextType, - content::REQUEST_CONTEXT_TYPE_LAST) +IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::RequestContextType, + blink::mojom::RequestContextType::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(content::ResourceType, content::RESOURCE_TYPE_LAST_TYPE - 1) IPC_ENUM_TRAITS_MAX_VALUE(content::MhtmlSaveStatus,
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index 841a62b60..0b2f949 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -47,7 +47,6 @@ #include "content/public/common/page_state.h" #include "content/public/common/previews_state.h" #include "content/public/common/referrer.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/screen_info.h" #include "content/public/common/stop_find_action.h" #include "content/public/common/three_d_api_types.h" @@ -61,6 +60,7 @@ #include "third_party/blink/public/common/messaging/message_port_channel.h" #include "third_party/blink/public/common/messaging/transferable_message.h" #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_focus_type.h" #include "third_party/blink/public/platform/web_insecure_request_policy.h" #include "third_party/blink/public/platform/web_intrinsic_sizing_info.h" @@ -727,7 +727,7 @@ IPC_STRUCT_BEGIN(FrameMsg_MixedContentFound_Params) IPC_STRUCT_MEMBER(GURL, main_resource_url) IPC_STRUCT_MEMBER(GURL, mixed_content_url) - IPC_STRUCT_MEMBER(content::RequestContextType, request_context_type) + IPC_STRUCT_MEMBER(blink::mojom::RequestContextType, request_context_type) IPC_STRUCT_MEMBER(bool, was_allowed) IPC_STRUCT_MEMBER(bool, had_redirect) IPC_STRUCT_MEMBER(content::SourceLocation, source_location)
diff --git a/content/common/navigation_params.h b/content/common/navigation_params.h index 748f4c2..0ce2dcf 100644 --- a/content/common/navigation_params.h +++ b/content/common/navigation_params.h
@@ -23,11 +23,11 @@ #include "content/public/common/page_state.h" #include "content/public/common/previews_state.h" #include "content/public/common/referrer.h" -#include "content/public/common/request_context_type.h" #include "net/url_request/redirect_info.h" #include "services/network/public/cpp/resource_request_body.h" #include "services/network/public/cpp/resource_response.h" #include "services/network/public/cpp/resource_response_info.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_mixed_content_context_type.h" #include "ui/base/page_transition_types.h" #include "url/gurl.h"
diff --git a/content/common/service_worker/service_worker.mojom b/content/common/service_worker/service_worker.mojom index 337a0bce..f081c2b8 100644 --- a/content/common/service_worker/service_worker.mojom +++ b/content/common/service_worker/service_worker.mojom
@@ -8,7 +8,7 @@ import "mojo/public/mojom/base/time.mojom"; import "services/network/public/mojom/cookie_manager.mojom"; import "third_party/blink/public/mojom/fetch/fetch_api_response.mojom"; -import "third_party/blink/public/mojom/messaging/message_port.mojom"; +import "third_party/blink/public/mojom/messaging/transferable_message.mojom"; import "third_party/blink/public/mojom/notifications/notification.mojom"; import "third_party/blink/public/mojom/payments/payment_app.mojom"; import "third_party/blink/public/mojom/service_worker/dispatch_fetch_event_params.mojom";
diff --git a/content/common/service_worker/service_worker_container.mojom b/content/common/service_worker/service_worker_container.mojom index 040ae784..c6a7e1e 100644 --- a/content/common/service_worker/service_worker_container.mojom +++ b/content/common/service_worker/service_worker_container.mojom
@@ -6,7 +6,7 @@ import "content/common/service_worker/controller_service_worker.mojom"; import "mojo/public/mojom/base/string16.mojom"; -import "third_party/blink/public/mojom/messaging/message_port.mojom"; +import "third_party/blink/public/mojom/messaging/transferable_message.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_error_type.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom";
diff --git a/content/common/service_worker/service_worker_fetch_request.typemap b/content/common/service_worker/service_worker_fetch_request.typemap index 70e608f8..4991157c 100644 --- a/content/common/service_worker/service_worker_fetch_request.typemap +++ b/content/common/service_worker/service_worker_fetch_request.typemap
@@ -4,17 +4,12 @@ mojom = "//third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom" -public_headers = [ - "//content/common/service_worker/service_worker_types.h", - "//content/public/common/request_context_type.h", -] +public_headers = [ "//content/common/service_worker/service_worker_types.h" ] traits_headers = [ "//content/common/service_worker/service_worker_fetch_request_mojom_traits.h", ] sources = [ "//content/common/service_worker/service_worker_fetch_request_mojom_traits.cc", ] -type_mappings = [ - "blink.mojom.FetchAPIRequest=::content::ServiceWorkerFetchRequest", - "blink.mojom.RequestContextType=::content::RequestContextType", -] +type_mappings = + [ "blink.mojom.FetchAPIRequest=::content::ServiceWorkerFetchRequest" ]
diff --git a/content/common/service_worker/service_worker_fetch_request_mojom_traits.cc b/content/common/service_worker/service_worker_fetch_request_mojom_traits.cc index 8962b22..7e857e5 100644 --- a/content/common/service_worker/service_worker_fetch_request_mojom_traits.cc +++ b/content/common/service_worker/service_worker_fetch_request_mojom_traits.cc
@@ -10,197 +10,8 @@ namespace mojo { -using blink::mojom::RequestContextType; using network::mojom::FetchRequestMode; -RequestContextType -EnumTraits<RequestContextType, content::RequestContextType>::ToMojom( - content::RequestContextType input) { - switch (input) { - case content::REQUEST_CONTEXT_TYPE_UNSPECIFIED: - return RequestContextType::UNSPECIFIED; - case content::REQUEST_CONTEXT_TYPE_AUDIO: - return RequestContextType::AUDIO; - case content::REQUEST_CONTEXT_TYPE_BEACON: - return RequestContextType::BEACON; - case content::REQUEST_CONTEXT_TYPE_CSP_REPORT: - return RequestContextType::CSP_REPORT; - case content::REQUEST_CONTEXT_TYPE_DOWNLOAD: - return RequestContextType::DOWNLOAD; - case content::REQUEST_CONTEXT_TYPE_EMBED: - return RequestContextType::EMBED; - case content::REQUEST_CONTEXT_TYPE_EVENT_SOURCE: - return RequestContextType::EVENT_SOURCE; - case content::REQUEST_CONTEXT_TYPE_FAVICON: - return RequestContextType::FAVICON; - case content::REQUEST_CONTEXT_TYPE_FETCH: - return RequestContextType::FETCH; - case content::REQUEST_CONTEXT_TYPE_FONT: - return RequestContextType::FONT; - case content::REQUEST_CONTEXT_TYPE_FORM: - return RequestContextType::FORM; - case content::REQUEST_CONTEXT_TYPE_FRAME: - return RequestContextType::FRAME; - case content::REQUEST_CONTEXT_TYPE_HYPERLINK: - return RequestContextType::HYPERLINK; - case content::REQUEST_CONTEXT_TYPE_IFRAME: - return RequestContextType::IFRAME; - case content::REQUEST_CONTEXT_TYPE_IMAGE: - return RequestContextType::IMAGE; - case content::REQUEST_CONTEXT_TYPE_IMAGE_SET: - return RequestContextType::IMAGE_SET; - case content::REQUEST_CONTEXT_TYPE_IMPORT: - return RequestContextType::IMPORT; - case content::REQUEST_CONTEXT_TYPE_INTERNAL: - return RequestContextType::INTERNAL; - case content::REQUEST_CONTEXT_TYPE_LOCATION: - return RequestContextType::LOCATION; - case content::REQUEST_CONTEXT_TYPE_MANIFEST: - return RequestContextType::MANIFEST; - case content::REQUEST_CONTEXT_TYPE_OBJECT: - return RequestContextType::OBJECT; - case content::REQUEST_CONTEXT_TYPE_PING: - return RequestContextType::PING; - case content::REQUEST_CONTEXT_TYPE_PLUGIN: - return RequestContextType::PLUGIN; - case content::REQUEST_CONTEXT_TYPE_PREFETCH: - return RequestContextType::PREFETCH; - case content::REQUEST_CONTEXT_TYPE_SCRIPT: - return RequestContextType::SCRIPT; - case content::REQUEST_CONTEXT_TYPE_SERVICE_WORKER: - return RequestContextType::SERVICE_WORKER; - case content::REQUEST_CONTEXT_TYPE_SHARED_WORKER: - return RequestContextType::SHARED_WORKER; - case content::REQUEST_CONTEXT_TYPE_SUBRESOURCE: - return RequestContextType::SUBRESOURCE; - case content::REQUEST_CONTEXT_TYPE_STYLE: - return RequestContextType::STYLE; - case content::REQUEST_CONTEXT_TYPE_TRACK: - return RequestContextType::TRACK; - case content::REQUEST_CONTEXT_TYPE_VIDEO: - return RequestContextType::VIDEO; - case content::REQUEST_CONTEXT_TYPE_WORKER: - return RequestContextType::WORKER; - case content::REQUEST_CONTEXT_TYPE_XML_HTTP_REQUEST: - return RequestContextType::XML_HTTP_REQUEST; - case content::REQUEST_CONTEXT_TYPE_XSLT: - return RequestContextType::XSLT; - } - - NOTREACHED(); - return RequestContextType::UNSPECIFIED; -} - -bool EnumTraits<RequestContextType, content::RequestContextType>::FromMojom( - RequestContextType input, - content::RequestContextType* out) { - switch (input) { - case RequestContextType::UNSPECIFIED: - *out = content::REQUEST_CONTEXT_TYPE_UNSPECIFIED; - return true; - case RequestContextType::AUDIO: - *out = content::REQUEST_CONTEXT_TYPE_AUDIO; - return true; - case RequestContextType::BEACON: - *out = content::REQUEST_CONTEXT_TYPE_BEACON; - return true; - case RequestContextType::CSP_REPORT: - *out = content::REQUEST_CONTEXT_TYPE_CSP_REPORT; - return true; - case RequestContextType::DOWNLOAD: - *out = content::REQUEST_CONTEXT_TYPE_DOWNLOAD; - return true; - case RequestContextType::EMBED: - *out = content::REQUEST_CONTEXT_TYPE_EMBED; - return true; - case RequestContextType::EVENT_SOURCE: - *out = content::REQUEST_CONTEXT_TYPE_EVENT_SOURCE; - return true; - case RequestContextType::FAVICON: - *out = content::REQUEST_CONTEXT_TYPE_FAVICON; - return true; - case RequestContextType::FETCH: - *out = content::REQUEST_CONTEXT_TYPE_FETCH; - return true; - case RequestContextType::FONT: - *out = content::REQUEST_CONTEXT_TYPE_FONT; - return true; - case RequestContextType::FORM: - *out = content::REQUEST_CONTEXT_TYPE_FORM; - return true; - case RequestContextType::FRAME: - *out = content::REQUEST_CONTEXT_TYPE_FRAME; - return true; - case RequestContextType::HYPERLINK: - *out = content::REQUEST_CONTEXT_TYPE_HYPERLINK; - return true; - case RequestContextType::IFRAME: - *out = content::REQUEST_CONTEXT_TYPE_IFRAME; - return true; - case RequestContextType::IMAGE: - *out = content::REQUEST_CONTEXT_TYPE_IMAGE; - return true; - case RequestContextType::IMAGE_SET: - *out = content::REQUEST_CONTEXT_TYPE_IMAGE_SET; - return true; - case RequestContextType::IMPORT: - *out = content::REQUEST_CONTEXT_TYPE_IMPORT; - return true; - case RequestContextType::INTERNAL: - *out = content::REQUEST_CONTEXT_TYPE_INTERNAL; - return true; - case RequestContextType::LOCATION: - *out = content::REQUEST_CONTEXT_TYPE_LOCATION; - return true; - case RequestContextType::MANIFEST: - *out = content::REQUEST_CONTEXT_TYPE_MANIFEST; - return true; - case RequestContextType::OBJECT: - *out = content::REQUEST_CONTEXT_TYPE_OBJECT; - return true; - case RequestContextType::PING: - *out = content::REQUEST_CONTEXT_TYPE_PING; - return true; - case RequestContextType::PLUGIN: - *out = content::REQUEST_CONTEXT_TYPE_PLUGIN; - return true; - case RequestContextType::PREFETCH: - *out = content::REQUEST_CONTEXT_TYPE_PREFETCH; - return true; - case RequestContextType::SCRIPT: - *out = content::REQUEST_CONTEXT_TYPE_SCRIPT; - return true; - case RequestContextType::SERVICE_WORKER: - *out = content::REQUEST_CONTEXT_TYPE_SERVICE_WORKER; - return true; - case RequestContextType::SHARED_WORKER: - *out = content::REQUEST_CONTEXT_TYPE_SHARED_WORKER; - return true; - case RequestContextType::SUBRESOURCE: - *out = content::REQUEST_CONTEXT_TYPE_SUBRESOURCE; - return true; - case RequestContextType::STYLE: - *out = content::REQUEST_CONTEXT_TYPE_STYLE; - return true; - case RequestContextType::TRACK: - *out = content::REQUEST_CONTEXT_TYPE_TRACK; - return true; - case RequestContextType::VIDEO: - *out = content::REQUEST_CONTEXT_TYPE_VIDEO; - return true; - case RequestContextType::WORKER: - *out = content::REQUEST_CONTEXT_TYPE_WORKER; - return true; - case RequestContextType::XML_HTTP_REQUEST: - *out = content::REQUEST_CONTEXT_TYPE_XML_HTTP_REQUEST; - return true; - case RequestContextType::XSLT: - *out = content::REQUEST_CONTEXT_TYPE_XSLT; - return true; - } - - return false; -} bool StructTraits<blink::mojom::FetchAPIRequestDataView, content::ServiceWorkerFetchRequest>::
diff --git a/content/common/service_worker/service_worker_fetch_request_mojom_traits.h b/content/common/service_worker/service_worker_fetch_request_mojom_traits.h index 40385d3..3a7f35d 100644 --- a/content/common/service_worker/service_worker_fetch_request_mojom_traits.h +++ b/content/common/service_worker/service_worker_fetch_request_mojom_traits.h
@@ -13,15 +13,6 @@ namespace mojo { -template <> -struct EnumTraits<blink::mojom::RequestContextType, - content::RequestContextType> { - static blink::mojom::RequestContextType ToMojom( - content::RequestContextType input); - - static bool FromMojom(blink::mojom::RequestContextType input, - content::RequestContextType* out); -}; template <> struct StructTraits<blink::mojom::FetchAPIRequestDataView, @@ -36,7 +27,7 @@ return request.is_main_resource_load; } - static content::RequestContextType request_context_type( + static blink::mojom::RequestContextType request_context_type( const content::ServiceWorkerFetchRequest& request) { return request.request_context_type; }
diff --git a/content/common/service_worker/service_worker_types.cc b/content/common/service_worker/service_worker_types.cc index c8c98cd..afb0f086 100644 --- a/content/common/service_worker/service_worker_types.cc +++ b/content/common/service_worker/service_worker_types.cc
@@ -67,7 +67,8 @@ request_proto.set_is_reload(is_reload); request_proto.set_mode(static_cast<int>(mode)); request_proto.set_is_main_resource_load(is_main_resource_load); - request_proto.set_request_context_type(request_context_type); + request_proto.set_request_context_type( + static_cast<int>(request_context_type)); request_proto.set_credentials_mode(static_cast<int>(credentials_mode)); request_proto.set_cache_mode(static_cast<int>(cache_mode)); request_proto.set_redirect_mode(static_cast<int>(redirect_mode)); @@ -111,8 +112,8 @@ request.mode = static_cast<network::mojom::FetchRequestMode>(request_proto.mode()); request.is_main_resource_load = request_proto.is_main_resource_load(); - request.request_context_type = - static_cast<RequestContextType>(request_proto.request_context_type()); + request.request_context_type = static_cast<blink::mojom::RequestContextType>( + request_proto.request_context_type()); request.credentials_mode = static_cast<network::mojom::FetchCredentialsMode>( request_proto.credentials_mode()); request.cache_mode =
diff --git a/content/common/service_worker/service_worker_types.h b/content/common/service_worker/service_worker_types.h index a7f686f..c9c1022 100644 --- a/content/common/service_worker/service_worker_types.h +++ b/content/common/service_worker/service_worker_types.h
@@ -16,7 +16,6 @@ #include "base/time/time.h" #include "content/common/content_export.h" #include "content/public/common/referrer.h" -#include "content/public/common/request_context_type.h" #include "services/network/public/mojom/fetch_api.mojom.h" #include "services/network/public/mojom/request_context_frame_type.mojom.h" #include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h" @@ -101,7 +100,8 @@ network::mojom::FetchRequestMode mode = network::mojom::FetchRequestMode::kNoCORS; bool is_main_resource_load = false; - RequestContextType request_context_type = REQUEST_CONTEXT_TYPE_UNSPECIFIED; + blink::mojom::RequestContextType request_context_type = + blink::mojom::RequestContextType::UNSPECIFIED; network::mojom::RequestContextFrameType frame_type = network::mojom::RequestContextFrameType::kNone; GURL url;
diff --git a/content/common/service_worker/service_worker_types_unittest.cc b/content/common/service_worker/service_worker_types_unittest.cc index 3de9f20e..2b74de97 100644 --- a/content/common/service_worker/service_worker_types_unittest.cc +++ b/content/common/service_worker/service_worker_types_unittest.cc
@@ -53,8 +53,7 @@ true); request.mode = network::mojom::FetchRequestMode::kSameOrigin; request.is_main_resource_load = true; - request.request_context_type = - RequestContextType::REQUEST_CONTEXT_TYPE_IFRAME; + request.request_context_type = blink::mojom::RequestContextType::IFRAME; request.credentials_mode = network::mojom::FetchCredentialsMode::kSameOrigin; request.cache_mode = blink::mojom::FetchCacheMode::kForceCache; request.redirect_mode = network::mojom::FetchRedirectMode::kManual;
diff --git a/content/public/browser/navigation_handle.h b/content/public/browser/navigation_handle.h index bd5c217b..3baba2d4 100644 --- a/content/public/browser/navigation_handle.h +++ b/content/public/browser/navigation_handle.h
@@ -326,9 +326,6 @@ // deferring NavigationThrottle do the resuming. virtual void CallResumeForTesting() = 0; - // Returns whether this navigation is currently deferred. - virtual bool IsDeferredForTesting() = 0; - // The NavigationData that the embedder returned from // ResourceDispatcherHostDelegate::GetNavigationData during commit. This will // be a clone of the NavigationData.
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index f22291e..1b12b44 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h
@@ -520,7 +520,12 @@ // Runs the beforeunload handler for the main frame and all its subframes. // See also ClosePage in RenderViewHostImpl, which runs the unload handler. - virtual void DispatchBeforeUnload() = 0; + // If |auto_cancel| is true, and the beforeunload handler returns a non-empty + // string (indicating the page wants to present a confirmation dialog), then + // the beforeunload operation will automatically return with |proceed=false| + // and no dialog will be shown to the user. This is used to interrupt a + // potential discard without causing the dialog to appear. + virtual void DispatchBeforeUnload(bool auto_cancel) = 0; // Attaches this inner WebContents to its container frame // |outer_contents_frame| in |outer_web_contents|.
diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index c3b56fa..89ff658d 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h
@@ -435,9 +435,11 @@ // Invoked before a form repost warning is shown. virtual void BeforeFormRepostWarningShow() {} - // Invoked when the beforeunload handler fires. The time is from the renderer - // process. - virtual void BeforeUnloadFired(const base::TimeTicks& proceed_time) {} + // Invoked when the beforeunload handler fires. |proceed| is set to true if + // the beforeunload can safely proceed, otherwise it should be interrupted. + // The time is from the renderer process. + virtual void BeforeUnloadFired(bool proceed, + const base::TimeTicks& proceed_time) {} // Invoked when a user cancels a before unload dialog. virtual void BeforeUnloadDialogCancelled() {}
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn index b2c5b33..dc3bf81 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn
@@ -187,7 +187,6 @@ "referrer.h", "renderer_preferences.cc", "renderer_preferences.h", - "request_context_type.h", "resource_request_body_android.cc", "resource_request_body_android.h", "resource_type.cc",
diff --git a/content/public/common/request_context_type.h b/content/public/common/request_context_type.h deleted file mode 100644 index 2a5a60a..0000000 --- a/content/public/common/request_context_type.h +++ /dev/null
@@ -1,50 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_PUBLIC_COMMON_REQUEST_CONTEXT_TYPE_H_ -#define CONTENT_PUBLIC_COMMON_REQUEST_CONTEXT_TYPE_H_ - -namespace content { - -enum RequestContextType { - REQUEST_CONTEXT_TYPE_UNSPECIFIED = 0, - REQUEST_CONTEXT_TYPE_AUDIO, - REQUEST_CONTEXT_TYPE_BEACON, - REQUEST_CONTEXT_TYPE_CSP_REPORT, - REQUEST_CONTEXT_TYPE_DOWNLOAD, - REQUEST_CONTEXT_TYPE_EMBED, - REQUEST_CONTEXT_TYPE_EVENT_SOURCE, - REQUEST_CONTEXT_TYPE_FAVICON, - REQUEST_CONTEXT_TYPE_FETCH, - REQUEST_CONTEXT_TYPE_FONT, - REQUEST_CONTEXT_TYPE_FORM, - REQUEST_CONTEXT_TYPE_FRAME, - REQUEST_CONTEXT_TYPE_HYPERLINK, - REQUEST_CONTEXT_TYPE_IFRAME, - REQUEST_CONTEXT_TYPE_IMAGE, - REQUEST_CONTEXT_TYPE_IMAGE_SET, - REQUEST_CONTEXT_TYPE_IMPORT, - REQUEST_CONTEXT_TYPE_INTERNAL, - REQUEST_CONTEXT_TYPE_LOCATION, - REQUEST_CONTEXT_TYPE_MANIFEST, - REQUEST_CONTEXT_TYPE_OBJECT, - REQUEST_CONTEXT_TYPE_PING, - REQUEST_CONTEXT_TYPE_PLUGIN, - REQUEST_CONTEXT_TYPE_PREFETCH, - REQUEST_CONTEXT_TYPE_SCRIPT, - REQUEST_CONTEXT_TYPE_SERVICE_WORKER, - REQUEST_CONTEXT_TYPE_SHARED_WORKER, - REQUEST_CONTEXT_TYPE_SUBRESOURCE, - REQUEST_CONTEXT_TYPE_STYLE, - REQUEST_CONTEXT_TYPE_TRACK, - REQUEST_CONTEXT_TYPE_VIDEO, - REQUEST_CONTEXT_TYPE_WORKER, - REQUEST_CONTEXT_TYPE_XML_HTTP_REQUEST, - REQUEST_CONTEXT_TYPE_XSLT, - REQUEST_CONTEXT_TYPE_LAST = REQUEST_CONTEXT_TYPE_XSLT -}; - -} // namespace content - -#endif // CONTENT_PUBLIC_COMMON_REQUEST_CONTEXT_TYPE_H_
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index fea58cd9..6459d9f6 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -80,6 +80,7 @@ #include "content/public/common/use_zoom_for_dsf_policy.h" #include "content/public/test/simple_url_loader_test_helper.h" #include "content/public/test/test_fileapi_operation_waiter.h" +#include "content/public/test/test_launcher.h" #include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_utils.h" #include "content/test/accessibility_browser_test_utils.h" @@ -1607,6 +1608,24 @@ ExecuteScriptAsync(web_contents, script); DOMMessageQueue message_queue; + + bool should_wait_flag = + base::CommandLine::ForCurrentProcess()->HasSwitch(kWaitForDebuggerWebUI); + + const std::string debugger_port = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + ::switches::kRemoteDebuggingPort); + + // Only wait if there is a debugger port, so user can issue go() command. + if (should_wait_flag && !debugger_port.empty()) { + ExecuteScriptAsync( + web_contents, + "window.waitUser = true; " + "window.go = function() { window.waitUser = false }; " + "console.log('Waiting for debugger...'); " + "console.log('Run: go() in the JS console when you are ready.');"); + } + ExecuteScriptAsync(web_contents, "runTests()"); std::string message;
diff --git a/content/public/test/navigation_simulator.cc b/content/public/test/navigation_simulator.cc index 5fc4a138..2b214f6 100644 --- a/content/public/test/navigation_simulator.cc +++ b/content/public/test/navigation_simulator.cc
@@ -935,7 +935,8 @@ mojom::BeginNavigationParamsPtr begin_params = mojom::BeginNavigationParams::New( std::string() /* headers */, net::LOAD_NORMAL, - false /* skip_service_worker */, REQUEST_CONTEXT_TYPE_HYPERLINK, + false /* skip_service_worker */, + blink::mojom::RequestContextType::HYPERLINK, blink::WebMixedContentContextType::kBlockable, false /* is_form_submission */, GURL() /* searchable_form_url */, std::string() /* searchable_form_encoding */, url::Origin(),
diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc index 0e9cc6ae..f7b9445 100644 --- a/content/public/test/render_view_test.cc +++ b/content/public/test/render_view_test.cc
@@ -276,7 +276,7 @@ // because it uses blink internally. blink_platform_impl_.Initialize(); blink::Initialize(blink_platform_impl_.Get(), &binder_registry_, - blink_platform_impl_.Get()->CurrentThread()); + blink_platform_impl_.GetMainThreadScheduler()); content_client_.reset(CreateContentClient()); content_browser_client_.reset(CreateContentBrowserClient());
diff --git a/content/public/test/render_view_test.h b/content/public/test/render_view_test.h index da99c6bb8..0182fa0 100644 --- a/content/public/test/render_view_test.h +++ b/content/public/test/render_view_test.h
@@ -68,6 +68,10 @@ void Initialize(); void Shutdown(); + blink::scheduler::WebThreadScheduler* GetMainThreadScheduler() { + return main_thread_scheduler_.get(); + } + private: std::unique_ptr<blink::scheduler::WebThreadScheduler> main_thread_scheduler_;
diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc index 3b3afff..10ced16 100644 --- a/content/public/test/test_launcher.cc +++ b/content/public/test/test_launcher.cc
@@ -572,6 +572,8 @@ const char kSingleProcessTestsFlag[] = "single_process"; +const char kWaitForDebuggerWebUI[] = "wait-for-debugger-webui"; + std::unique_ptr<TestState> TestLauncherDelegate::PreRunTest( base::CommandLine* command_line, base::TestLauncher::LaunchOptions* test_launch_options) {
diff --git a/content/public/test/test_launcher.h b/content/public/test/test_launcher.h index 74fe0d6..fcb4f52 100644 --- a/content/public/test/test_launcher.h +++ b/content/public/test/test_launcher.h
@@ -29,6 +29,9 @@ // Flag that causes only the kEmptyTestName test to be run. extern const char kWarmupFlag[]; +// Flag used by WebUI test runners to wait for debugger to be attached. +extern const char kWaitForDebuggerWebUI[]; + // See details in PreRunTest(). class TestState { public:
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc index aea320e1..6ea362f 100644 --- a/content/renderer/browser_plugin/browser_plugin.cc +++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -871,7 +871,8 @@ } void BrowserPlugin::SetLayer(scoped_refptr<cc::Layer> layer, - bool prevent_contents_opaque_changes) { + bool prevent_contents_opaque_changes, + bool is_surface_layer) { if (container_) container_->SetCcLayer(layer.get(), prevent_contents_opaque_changes); embedded_layer_ = std::move(layer); @@ -881,8 +882,4 @@ return GetContentClient()->renderer()->GetSadWebViewBitmap(); } -bool BrowserPlugin::HasPointerEventsNone() { - return false; -} - } // namespace content
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h index 5896a9d..951a103f 100644 --- a/content/renderer/browser_plugin/browser_plugin.h +++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -226,11 +226,10 @@ // ChildFrameCompositor: cc::Layer* GetLayer() override; void SetLayer(scoped_refptr<cc::Layer> layer, - bool prevent_contents_opaque_changes) override; + bool prevent_contents_opaque_changes, + bool is_surface_layer) override; SkBitmap* GetSadPageBitmap() override; - bool HasPointerEventsNone() override; - // This indicates whether this BrowserPlugin has been attached to a // WebContents and is ready to receive IPCs. bool attached_;
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc index 7c502bad..8be3470 100644 --- a/content/renderer/child_frame_compositing_helper.cc +++ b/content/renderer/child_frame_compositing_helper.cc
@@ -67,7 +67,8 @@ bool prevent_contents_opaque_changes = false; child_frame_compositor_->SetLayer(std::move(crashed_layer), - prevent_contents_opaque_changes); + prevent_contents_opaque_changes, + false /* is_surface_layer */); } void ChildFrameCompositingHelper::SetPrimarySurfaceId( @@ -82,8 +83,6 @@ surface_layer_ = cc::SurfaceLayer::Create(); surface_layer_->SetMasksToBounds(true); surface_layer_->SetSurfaceHitTestable(true); - surface_layer_->SetHasPointerEventsNone( - child_frame_compositor_->HasPointerEventsNone()); surface_layer_->SetBackgroundColor(SK_ColorTRANSPARENT); surface_layer_->SetPrimarySurfaceId(surface_id, deadline); @@ -93,7 +92,8 @@ // about the child surface's opacity. https://crbug.com/629851. bool prevent_contents_opaque_changes = true; child_frame_compositor_->SetLayer(surface_layer_, - prevent_contents_opaque_changes); + prevent_contents_opaque_changes, + true /* is_surface_layer */); UpdateVisibility(true); @@ -120,14 +120,4 @@ layer->SetIsDrawable(visible); } -void ChildFrameCompositingHelper::SetHasPointerEventsNone( - bool has_pointer_events_none) { - if (!primary_surface_id_.is_valid()) - return; - cc::SurfaceLayer* layer = - static_cast<cc::SurfaceLayer*>(child_frame_compositor_->GetLayer()); - if (layer) - layer->SetHasPointerEventsNone(has_pointer_events_none); -} - } // namespace content
diff --git a/content/renderer/child_frame_compositing_helper.h b/content/renderer/child_frame_compositing_helper.h index 23cf9f76..7a05417 100644 --- a/content/renderer/child_frame_compositing_helper.h +++ b/content/renderer/child_frame_compositing_helper.h
@@ -41,7 +41,6 @@ void SetFallbackSurfaceId(const viz::SurfaceId& surface_id, const gfx::Size& frame_size_in_dip); void UpdateVisibility(bool visible); - void SetHasPointerEventsNone(bool has_pointer_events_none); void ChildFrameGone(const gfx::Size& frame_size_in_dip, float device_scale_factor);
diff --git a/content/renderer/child_frame_compositing_helper_unittest.cc b/content/renderer/child_frame_compositing_helper_unittest.cc index a42db10..3d4d6824 100644 --- a/content/renderer/child_frame_compositing_helper_unittest.cc +++ b/content/renderer/child_frame_compositing_helper_unittest.cc
@@ -23,12 +23,11 @@ cc::Layer* GetLayer() override { return layer_.get(); } void SetLayer(scoped_refptr<cc::Layer> layer, - bool prevent_contents_opaque_changes) override { + bool prevent_contents_opaque_changes, + bool is_surface_layer) override { layer_ = std::move(layer); } - bool HasPointerEventsNone() override { return false; } - SkBitmap* GetSadPageBitmap() override { return &sad_page_bitmap_; } private:
diff --git a/content/renderer/child_frame_compositor.h b/content/renderer/child_frame_compositor.h index a2a22c5..fa0a875 100644 --- a/content/renderer/child_frame_compositor.h +++ b/content/renderer/child_frame_compositor.h
@@ -20,12 +20,11 @@ // Passes ownership of a cc::Layer to the ChildFrameCompositor. virtual void SetLayer(scoped_refptr<cc::Layer> layer, - bool prevent_contents_opaque_changes) = 0; + bool prevent_contents_opaque_changes, + bool is_surface_layer) = 0; // Returns a sad page bitmap used when the child frame has crashed. virtual SkBitmap* GetSadPageBitmap() = 0; - - virtual bool HasPointerEventsNone() = 0; }; } // namespace content
diff --git a/content/renderer/fetchers/multi_resolution_image_resource_fetcher.h b/content/renderer/fetchers/multi_resolution_image_resource_fetcher.h index 06117ee0..430be3f 100644 --- a/content/renderer/fetchers/multi_resolution_image_resource_fetcher.h +++ b/content/renderer/fetchers/multi_resolution_image_resource_fetcher.h
@@ -11,7 +11,7 @@ #include "base/callback.h" #include "base/macros.h" -#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom-shared.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_url_request.h" #include "url/gurl.h"
diff --git a/content/renderer/image_downloader/image_downloader_base.cc b/content/renderer/image_downloader/image_downloader_base.cc index cd2b138..8b9a409e 100644 --- a/content/renderer/image_downloader/image_downloader_base.cc +++ b/content/renderer/image_downloader/image_downloader_base.cc
@@ -14,7 +14,7 @@ #include "content/public/renderer/render_thread.h" #include "content/renderer/fetchers/multi_resolution_image_resource_fetcher.h" #include "net/base/data_url.h" -#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom-shared.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/public/web/web_local_frame.h" #include "ui/gfx/favicon_size.h"
diff --git a/content/renderer/internal_document_state_data.h b/content/renderer/internal_document_state_data.h index 5f995cf..1d774d6 100644 --- a/content/renderer/internal_document_state_data.h +++ b/content/renderer/internal_document_state_data.h
@@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/supports_user_data.h" -#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom-shared.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "url/gurl.h" namespace blink {
diff --git a/content/renderer/loader/resource_dispatcher.cc b/content/renderer/loader/resource_dispatcher.cc index 7d82097..6e67dee 100644 --- a/content/renderer/loader/resource_dispatcher.cc +++ b/content/renderer/loader/resource_dispatcher.cc
@@ -792,7 +792,8 @@ uint32_t options = network::mojom::kURLLoadOptionNone; // TODO(jam): use this flag for ResourceDispatcherHost code path once // MojoLoading is the only IPC code path. - if (request->fetch_request_context_type != REQUEST_CONTEXT_TYPE_FETCH) { + if (request->fetch_request_context_type != + static_cast<int>(blink::mojom::RequestContextType::FETCH)) { // MIME sniffing should be disabled for a request initiated by fetch(). options |= network::mojom::kURLLoadOptionSniffMimeType; if (blink::ServiceWorkerUtils::IsServicificationEnabled())
diff --git a/content/renderer/loader/url_loader_client_impl_unittest.cc b/content/renderer/loader/url_loader_client_impl_unittest.cc index 2fc2884..bdb6d90e 100644 --- a/content/renderer/loader/url_loader_client_impl_unittest.cc +++ b/content/renderer/loader/url_loader_client_impl_unittest.cc
@@ -7,7 +7,6 @@ #include <vector> #include "base/message_loop/message_loop.h" #include "base/run_loop.h" -#include "content/public/common/request_context_type.h" #include "content/renderer/loader/navigation_response_override_parameters.h" #include "content/renderer/loader/resource_dispatcher.h" #include "content/renderer/loader/test_request_peer.h" @@ -18,6 +17,7 @@ #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" namespace content { @@ -30,7 +30,8 @@ // Set request context type to fetch so that ResourceDispatcher doesn't // install MimeSniffingThrottle, which makes URLLoaderThrottleLoader // defer the request. - request->fetch_request_context_type = REQUEST_CONTEXT_TYPE_FETCH; + request->fetch_request_context_type = + static_cast<int>(blink::mojom::RequestContextType::FETCH); request_id_ = dispatcher_->StartAsync( std::move(request), 0, blink::scheduler::GetSingleThreadTaskRunnerForTesting(),
diff --git a/content/renderer/loader/web_url_loader_impl.cc b/content/renderer/loader/web_url_loader_impl.cc index d32ccda..c313497 100644 --- a/content/renderer/loader/web_url_loader_impl.cc +++ b/content/renderer/loader/web_url_loader_impl.cc
@@ -693,7 +693,7 @@ resource_request->fetch_integrity = GetFetchIntegrityForWebURLRequest(request); resource_request->fetch_request_context_type = - GetRequestContextTypeForWebURLRequest(request); + static_cast<int>(GetRequestContextTypeForWebURLRequest(request)); resource_request->fetch_frame_type = request.GetFrameType(); resource_request->request_body =
diff --git a/content/renderer/loader/web_url_request_util.cc b/content/renderer/loader/web_url_request_util.cc index a7c47640..f925754 100644 --- a/content/renderer/loader/web_url_request_util.cc +++ b/content/renderer/loader/web_url_request_util.cc
@@ -27,7 +27,7 @@ #include "third_party/blink/public/mojom/blob/blob_registry.mojom.h" #include "third_party/blink/public/platform/file_path_conversion.h" #include "third_party/blink/public/platform/interface_provider.h" -#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom-shared.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_data.h" #include "third_party/blink/public/platform/web_http_body.h" @@ -456,78 +456,79 @@ return request.GetFetchIntegrity().Utf8(); } -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_UNSPECIFIED, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::UNSPECIFIED, WebURLRequest::kRequestContextUnspecified); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_AUDIO, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::AUDIO, WebURLRequest::kRequestContextAudio); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_BEACON, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::BEACON, WebURLRequest::kRequestContextBeacon); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_CSP_REPORT, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::CSP_REPORT, WebURLRequest::kRequestContextCSPReport); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_DOWNLOAD, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::DOWNLOAD, WebURLRequest::kRequestContextDownload); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_EMBED, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::EMBED, WebURLRequest::kRequestContextEmbed); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_EVENT_SOURCE, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::EVENT_SOURCE, WebURLRequest::kRequestContextEventSource); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_FAVICON, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::FAVICON, WebURLRequest::kRequestContextFavicon); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_FETCH, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::FETCH, WebURLRequest::kRequestContextFetch); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_FONT, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::FONT, WebURLRequest::kRequestContextFont); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_FORM, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::FORM, WebURLRequest::kRequestContextForm); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_FRAME, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::FRAME, WebURLRequest::kRequestContextFrame); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_HYPERLINK, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::HYPERLINK, WebURLRequest::kRequestContextHyperlink); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_IFRAME, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::IFRAME, WebURLRequest::kRequestContextIframe); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_IMAGE, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::IMAGE, WebURLRequest::kRequestContextImage); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_IMAGE_SET, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::IMAGE_SET, WebURLRequest::kRequestContextImageSet); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_IMPORT, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::IMPORT, WebURLRequest::kRequestContextImport); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_INTERNAL, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::INTERNAL, WebURLRequest::kRequestContextInternal); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_LOCATION, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::LOCATION, WebURLRequest::kRequestContextLocation); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_MANIFEST, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::MANIFEST, WebURLRequest::kRequestContextManifest); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_OBJECT, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::OBJECT, WebURLRequest::kRequestContextObject); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_PING, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::PING, WebURLRequest::kRequestContextPing); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_PLUGIN, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::PLUGIN, WebURLRequest::kRequestContextPlugin); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_PREFETCH, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::PREFETCH, WebURLRequest::kRequestContextPrefetch); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_SCRIPT, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::SCRIPT, WebURLRequest::kRequestContextScript); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_SERVICE_WORKER, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::SERVICE_WORKER, WebURLRequest::kRequestContextServiceWorker); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_SHARED_WORKER, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::SHARED_WORKER, WebURLRequest::kRequestContextSharedWorker); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_SUBRESOURCE, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::SUBRESOURCE, WebURLRequest::kRequestContextSubresource); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_STYLE, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::STYLE, WebURLRequest::kRequestContextStyle); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_TRACK, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::TRACK, WebURLRequest::kRequestContextTrack); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_VIDEO, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::VIDEO, WebURLRequest::kRequestContextVideo); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_WORKER, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::WORKER, WebURLRequest::kRequestContextWorker); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XML_HTTP_REQUEST, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::XML_HTTP_REQUEST, WebURLRequest::kRequestContextXMLHttpRequest); -STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XSLT, +STATIC_ASSERT_ENUM(blink::mojom::RequestContextType::XSLT, WebURLRequest::kRequestContextXSLT); -RequestContextType GetRequestContextTypeForWebURLRequest( +blink::mojom::RequestContextType GetRequestContextTypeForWebURLRequest( const WebURLRequest& request) { - return static_cast<RequestContextType>(request.GetRequestContext()); + return static_cast<blink::mojom::RequestContextType>( + request.GetRequestContext()); } blink::WebMixedContentContextType GetMixedContentContextTypeForWebURLRequest(
diff --git a/content/renderer/loader/web_url_request_util.h b/content/renderer/loader/web_url_request_util.h index bc85bb6..199390c 100644 --- a/content/renderer/loader/web_url_request_util.h +++ b/content/renderer/loader/web_url_request_util.h
@@ -8,12 +8,12 @@ #include <string> #include "content/common/content_export.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "net/http/http_request_headers.h" #include "services/network/public/cpp/resource_request_body.h" #include "services/network/public/mojom/request_context_frame_type.mojom.h" #include "third_party/blink/public/mojom/blob/blob_registry.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_mixed_content_context_type.h" #include "third_party/blink/public/platform/web_url_request.h" @@ -68,7 +68,7 @@ // type. std::string GetFetchIntegrityForWebURLRequest( const blink::WebURLRequest& request); -RequestContextType GetRequestContextTypeForWebURLRequest( +blink::mojom::RequestContextType GetRequestContextTypeForWebURLRequest( const blink::WebURLRequest& request); blink::WebMixedContentContextType GetMixedContentContextTypeForWebURLRequest( const blink::WebURLRequest& request);
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index a3ff3c5b..949385e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -176,7 +176,7 @@ #include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h" #include "third_party/blink/public/platform/file_path_conversion.h" #include "third_party/blink/public/platform/interface_provider.h" -#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom-shared.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/modules/permissions/permission.mojom.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h" #include "third_party/blink/public/platform/url_conversion.h"
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 5279061..e6777ce 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -45,7 +45,6 @@ #include "content/public/common/previews_state.h" #include "content/public/common/referrer.h" #include "content/public/common/renderer_preferences.h" -#include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "content/public/common/stop_find_action.h" #include "content/public/renderer/render_frame.h" @@ -77,6 +76,7 @@ #include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h" #include "third_party/blink/public/platform/autoplay.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/platform/web_effective_connection_type.h" #include "third_party/blink/public/platform/web_focus_type.h" #include "third_party/blink/public/platform/web_loading_behavior_flag.h"
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc index 16f9ce3..090e811 100644 --- a/content/renderer/render_frame_proxy.cc +++ b/content/renderer/render_frame_proxy.cc
@@ -838,10 +838,6 @@ touch_action)); } -void RenderFrameProxy::PointerEventsChanged() { - compositing_helper_->SetHasPointerEventsNone(HasPointerEventsNone()); -} - void RenderFrameProxy::UpdateRenderThrottlingStatus(bool is_throttled, bool subtree_throttled) { Send(new FrameHostMsg_UpdateRenderThrottlingStatus(routing_id_, is_throttled, @@ -900,9 +896,12 @@ } void RenderFrameProxy::SetLayer(scoped_refptr<cc::Layer> layer, - bool prevent_contents_opaque_changes) { - if (web_frame()) - web_frame()->SetCcLayer(layer.get(), prevent_contents_opaque_changes); + bool prevent_contents_opaque_changes, + bool is_surface_layer) { + if (web_frame()) { + web_frame()->SetCcLayer(layer.get(), prevent_contents_opaque_changes, + is_surface_layer); + } embedded_layer_ = std::move(layer); } @@ -910,10 +909,6 @@ return GetContentClient()->renderer()->GetSadWebViewBitmap(); } -bool RenderFrameProxy::HasPointerEventsNone() { - return web_frame()->OOPIFHasPointerEventsNone(); -} - uint32_t RenderFrameProxy::Print(const blink::WebRect& rect, cc::PaintCanvas* canvas) { #if BUILDFLAG(ENABLE_PRINTING)
diff --git a/content/renderer/render_frame_proxy.h b/content/renderer/render_frame_proxy.h index d7d727cc..1d2cfcfb 100644 --- a/content/renderer/render_frame_proxy.h +++ b/content/renderer/render_frame_proxy.h
@@ -201,7 +201,6 @@ void VisibilityChanged(bool visible) override; void SetIsInert(bool) override; void SetInheritedEffectiveTouchAction(cc::TouchAction) override; - void PointerEventsChanged() override; void UpdateRenderThrottlingStatus(bool is_throttled, bool subtree_throttled) override; void DidChangeOpener(blink::WebFrame* opener) override; @@ -275,9 +274,9 @@ // ChildFrameCompositor: cc::Layer* GetLayer() override; void SetLayer(scoped_refptr<cc::Layer> layer, - bool prevent_contents_opaque_changes) override; + bool prevent_contents_opaque_changes, + bool is_surface_layer) override; SkBitmap* GetSadPageBitmap() override; - bool HasPointerEventsNone() override; const viz::LocalSurfaceId& GetLocalSurfaceId() const;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 91cd931..ee3d027 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -1222,7 +1222,7 @@ ->renderer() ->SetRuntimeFeaturesDefaultsBeforeBlinkInitialization(); blink::Initialize(blink_platform_impl_.get(), registry, - blink_platform_impl_->CurrentThread()); + main_thread_scheduler_.get()); v8::Isolate* isolate = blink::MainThreadIsolate(); isolate->SetCreateHistogramFunction(CreateHistogram);
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc index 929aa302..1aedcf8 100644 --- a/content/renderer/service_worker/service_worker_context_client.cc +++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -172,7 +172,7 @@ }; WebURLRequest::RequestContext GetBlinkRequestContext( - RequestContextType request_context_type) { + blink::mojom::RequestContextType request_context_type) { return static_cast<WebURLRequest::RequestContext>(request_context_type); } @@ -285,8 +285,9 @@ web_request->SetCacheMode( ServiceWorkerFetchRequest::GetCacheModeFromLoadFlags(request.load_flags)); web_request->SetRedirectMode(request.fetch_redirect_mode); - web_request->SetRequestContext(GetBlinkRequestContext( - static_cast<RequestContextType>(request.fetch_request_context_type))); + web_request->SetRequestContext( + GetBlinkRequestContext(static_cast<blink::mojom::RequestContextType>( + request.fetch_request_context_type))); web_request->SetFrameType(request.fetch_frame_type); web_request->SetClientId(blink::WebString::FromUTF8(client_id)); web_request->SetIsReload(ui::PageTransitionCoreTypeIs(
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 3601ada..b01fcb0b 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -734,7 +734,6 @@ "../browser/blob_storage/blob_storage_browsertest.cc", "../browser/blob_storage/blob_url_browsertest.cc", "../browser/bookmarklet_browsertest.cc", - "../browser/browser_side_navigation_browsertest.cc", "../browser/browser_thread_browsertest.cc", "../browser/browsing_data/browsing_data_remover_impl_browsertest.cc", "../browser/browsing_data/clear_site_data_handler_browsertest.cc", @@ -815,6 +814,7 @@ "../browser/memory/memory_coordinator_impl_browsertest.cc", "../browser/message_port_provider_browsertest.cc", "../browser/mojo_sandbox_browsertest.cc", + "../browser/navigation_browsertest.cc", "../browser/net/accept_header_browsertest.cc", "../browser/net_info_browsertest.cc", "../browser/network_service_browsertest.cc",
diff --git a/content/test/test_blink_web_unit_test_support.cc b/content/test/test_blink_web_unit_test_support.cc index b4acd3c..ae7fbe5 100644 --- a/content/test/test_blink_web_unit_test_support.cc +++ b/content/test/test_blink_web_unit_test_support.cc
@@ -147,7 +147,7 @@ scoped_refptr<base::SingleThreadTaskRunner> dummy_task_runner; std::unique_ptr<base::ThreadTaskRunnerHandle> dummy_task_runner_handle; if (!base::ThreadTaskRunnerHandle::IsSet()) { - // Dummy task runner is initialized here because the blink::initialize + // Dummy task runner is initialized here because the blink::Initialize // creates IsolateHolder which needs the current task runner handle. There // should be no task posted to this task runner. The message loop is not // created before this initialization because some tests need specific kinds @@ -160,7 +160,6 @@ } main_thread_scheduler_ = blink::scheduler::CreateWebMainThreadSchedulerForTests(); - web_thread_ = main_thread_scheduler_->CreateMainThread(); // Initialize mojo firstly to enable Blink initialization to use it. InitializeMojo(); @@ -178,7 +177,7 @@ weak_factory_.GetWeakPtr())); service_manager::BinderRegistry empty_registry; - blink::Initialize(this, &empty_registry, CurrentThread()); + blink::Initialize(this, &empty_registry, main_thread_scheduler_.get()); g_test_platform = this; blink::SetLayoutTestMode(true); blink::WebRuntimeFeatures::EnableDatabase(true); @@ -303,8 +302,8 @@ } blink::WebThread* TestBlinkWebUnitTestSupport::CurrentThread() { - if (web_thread_ && web_thread_->IsCurrentThread()) - return web_thread_.get(); + if (main_thread_->IsCurrentThread()) + return main_thread_; return BlinkPlatformImpl::CurrentThread(); }
diff --git a/content/test/test_blink_web_unit_test_support.h b/content/test/test_blink_web_unit_test_support.h index 925a878..d1c69bc 100644 --- a/content/test/test_blink_web_unit_test_support.h +++ b/content/test/test_blink_web_unit_test_support.h
@@ -80,7 +80,6 @@ base::ScopedTempDir file_system_root_; std::unique_ptr<blink::WebURLLoaderMockFactory> url_loader_factory_; std::unique_ptr<blink::scheduler::WebThreadScheduler> main_thread_scheduler_; - std::unique_ptr<blink::WebThread> web_thread_; bool threaded_animation_ = true; base::WeakPtrFactory<TestBlinkWebUnitTestSupport> weak_factory_;
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc index 0cf6c55..151b260 100644 --- a/content/test/test_render_frame_host.cc +++ b/content/test/test_render_frame_host.cc
@@ -440,7 +440,8 @@ mojom::BeginNavigationParamsPtr begin_params = mojom::BeginNavigationParams::New( std::string() /* headers */, net::LOAD_NORMAL, - false /* skip_service_worker */, REQUEST_CONTEXT_TYPE_HYPERLINK, + false /* skip_service_worker */, + blink::mojom::RequestContextType::HYPERLINK, blink::WebMixedContentContextType::kBlockable, false /* is_form_submission */, GURL() /* searchable_form_url */, std::string() /* searchable_form_encoding */, url::Origin(),
diff --git a/device/BUILD.gn b/device/BUILD.gn index 7daf2e11..b929cea 100644 --- a/device/BUILD.gn +++ b/device/BUILD.gn
@@ -73,6 +73,7 @@ "fido/ble/fido_ble_connection_unittest.cc", "fido/ble/fido_ble_device_unittest.cc", "fido/ble/fido_ble_frames_unittest.cc", + "fido/ble/fido_ble_transaction_unittest.cc", "fido/ble_adapter_power_manager_unittest.cc", "fido/cable/fido_cable_device_unittest.cc", "fido/cable/fido_cable_discovery_unittest.cc",
diff --git a/device/bluetooth/bluetooth_init_win.cc b/device/bluetooth/bluetooth_init_win.cc index d6a30c6..7c1d19c 100644 --- a/device/bluetooth/bluetooth_init_win.cc +++ b/device/bluetooth/bluetooth_init_win.cc
@@ -4,7 +4,7 @@ #include "device/bluetooth/bluetooth_init_win.h" -#include "base/threading/thread_restrictions.h" +#include "base/threading/scoped_blocking_call.h" namespace { @@ -28,7 +28,8 @@ } has_bluetooth_stack = HBS_UNKNOWN; if (has_bluetooth_stack == HBS_UNKNOWN) { - base::AssertBlockingAllowed(); + base::ScopedBlockingCall scoped_blocking_call( + base::BlockingType::MAY_BLOCK); HRESULT hr = E_FAIL; __try { hr = __HrLoadAllImportsForDll("bthprops.cpl");
diff --git a/device/bluetooth/bluetooth_socket_net.cc b/device/bluetooth/bluetooth_socket_net.cc index 079fd310..515ccc8 100644 --- a/device/bluetooth/bluetooth_socket_net.cc +++ b/device/bluetooth/bluetooth_socket_net.cc
@@ -14,7 +14,7 @@ #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" -#include "base/threading/thread_restrictions.h" +#include "base/threading/scoped_blocking_call.h" #include "device/bluetooth/bluetooth_socket.h" #include "device/bluetooth/bluetooth_socket_thread.h" #include "net/base/completion_callback.h" @@ -124,7 +124,7 @@ void BluetoothSocketNet::DoClose() { DCHECK(socket_thread_->task_runner()->RunsTasksInCurrentSequence()); - base::AssertBlockingAllowed(); + base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK); if (tcp_socket_) { tcp_socket_->Close(); @@ -143,7 +143,6 @@ void BluetoothSocketNet::DoDisconnect(const base::Closure& callback) { DCHECK(socket_thread_->task_runner()->RunsTasksInCurrentSequence()); - base::AssertBlockingAllowed(); DoClose(); callback.Run(); @@ -154,7 +153,7 @@ const ReceiveCompletionCallback& success_callback, const ReceiveErrorCompletionCallback& error_callback) { DCHECK(socket_thread_->task_runner()->RunsTasksInCurrentSequence()); - base::AssertBlockingAllowed(); + base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK); if (!tcp_socket_) { error_callback.Run(BluetoothSocket::kDisconnected, kSocketNotConnected); @@ -187,7 +186,6 @@ const ReceiveErrorCompletionCallback& error_callback, int read_result) { DCHECK(socket_thread_->task_runner()->RunsTasksInCurrentSequence()); - base::AssertBlockingAllowed(); scoped_refptr<net::IOBufferWithSize> buffer; buffer.swap(read_buffer_); @@ -210,7 +208,6 @@ const SendCompletionCallback& success_callback, const ErrorCompletionCallback& error_callback) { DCHECK(socket_thread_->task_runner()->RunsTasksInCurrentSequence()); - base::AssertBlockingAllowed(); if (!tcp_socket_) { error_callback.Run(kSocketNotConnected); @@ -231,7 +228,7 @@ void BluetoothSocketNet::SendFrontWriteRequest() { DCHECK(socket_thread_->task_runner()->RunsTasksInCurrentSequence()); - base::AssertBlockingAllowed(); + base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK); if (!tcp_socket_) return; @@ -282,7 +279,6 @@ const ErrorCompletionCallback& error_callback, int send_result) { DCHECK(socket_thread_->task_runner()->RunsTasksInCurrentSequence()); - base::AssertBlockingAllowed(); write_queue_.pop();
diff --git a/device/bluetooth/bluetooth_socket_win.cc b/device/bluetooth/bluetooth_socket_win.cc index c7db830d..0fe007c 100644 --- a/device/bluetooth/bluetooth_socket_win.cc +++ b/device/bluetooth/bluetooth_socket_win.cc
@@ -16,7 +16,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" -#include "base/threading/thread_restrictions.h" +#include "base/threading/scoped_blocking_call.h" #include "device/bluetooth/bluetooth_device_win.h" #include "device/bluetooth/bluetooth_init_win.h" #include "device/bluetooth/bluetooth_service_record_win.h" @@ -181,7 +181,7 @@ const base::Closure& success_callback, const ErrorCompletionCallback& error_callback) { DCHECK(socket_thread()->task_runner()->RunsTasksInCurrentSequence()); - base::AssertBlockingAllowed(); + base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK); if (tcp_socket()) { error_callback.Run(kSocketAlreadyConnected);
diff --git a/device/fido/ble/fido_ble_frames.cc b/device/fido/ble/fido_ble_frames.cc index 0c50b56..bbee787 100644 --- a/device/fido/ble/fido_ble_frames.cc +++ b/device/fido/ble/fido_ble_frames.cc
@@ -6,6 +6,7 @@ #include <algorithm> #include <limits> +#include <tuple> #include "base/logging.h" #include "base/numerics/safe_conversions.h" @@ -20,6 +21,9 @@ std::vector<uint8_t> data) : command_(command), data_(std::move(data)) {} +FidoBleFrame::FidoBleFrame(const FidoBleFrame&) = default; +FidoBleFrame& FidoBleFrame::operator=(const FidoBleFrame&) = default; + FidoBleFrame::FidoBleFrame(FidoBleFrame&&) = default; FidoBleFrame& FidoBleFrame::operator=(FidoBleFrame&&) = default; @@ -82,6 +86,11 @@ return {initial_fragment, std::move(other_fragments)}; } +bool operator==(const FidoBleFrame& lhs, const FidoBleFrame& rhs) { + return std::forward_as_tuple(lhs.command(), lhs.data()) == + std::forward_as_tuple(rhs.command(), rhs.data()); +} + FidoBleFrameFragment::FidoBleFrameFragment() = default; FidoBleFrameFragment::FidoBleFrameFragment(const FidoBleFrameFragment& frame) =
diff --git a/device/fido/ble/fido_ble_frames.h b/device/fido/ble/fido_ble_frames.h index ea4d16a..17a8367 100644 --- a/device/fido/ble/fido_ble_frames.h +++ b/device/fido/ble/fido_ble_frames.h
@@ -59,6 +59,9 @@ FidoBleFrame(); FidoBleFrame(FidoBleDeviceCommand command, std::vector<uint8_t> data); + FidoBleFrame(const FidoBleFrame&); + FidoBleFrame& operator=(const FidoBleFrame&); + FidoBleFrame(FidoBleFrame&&); FidoBleFrame& operator=(FidoBleFrame&&); @@ -86,10 +89,11 @@ private: FidoBleDeviceCommand command_ = FidoBleDeviceCommand::kMsg; std::vector<uint8_t> data_; - - DISALLOW_COPY_AND_ASSIGN(FidoBleFrame); }; +COMPONENT_EXPORT(DEVICE_FIDO) +bool operator==(const FidoBleFrame& lhs, const FidoBleFrame& rhs); + // A single frame sent over BLE may be split over multiple writes and // notifications because the technology was not designed for large messages. // This class represents a single fragment. Not to be used directly.
diff --git a/device/fido/ble/fido_ble_transaction.cc b/device/fido/ble/fido_ble_transaction.cc index 59ac876..e462469 100644 --- a/device/fido/ble/fido_ble_transaction.cc +++ b/device/fido/ble/fido_ble_transaction.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "base/threading/thread_task_runner_handle.h" #include "device/fido/ble/fido_ble_connection.h" #include "device/fido/fido_constants.h" @@ -23,6 +24,13 @@ void FidoBleTransaction::WriteRequestFrame(FidoBleFrame request_frame, FrameCallback callback) { + if (control_point_length_ < 3u) { + VLOG(2) << "Control Point Length is too short: " << control_point_length_; + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), base::nullopt)); + return; + } + DCHECK(!request_frame_ && callback_.is_null()); request_frame_ = std::move(request_frame); callback_ = std::move(callback); @@ -37,6 +45,8 @@ const FidoBleFrameFragment& fragment) { buffer_.clear(); fragment.Serialize(&buffer_); + DCHECK(!has_pending_request_fragment_write_); + has_pending_request_fragment_write_ = true; // A weak pointer is required, since this call might time out. If that // happens, the current FidoBleTransaction could be destroyed. connection_->WriteControlPoint( @@ -48,22 +58,31 @@ } void FidoBleTransaction::OnRequestFragmentWritten(bool success) { + DCHECK(has_pending_request_fragment_write_); + has_pending_request_fragment_write_ = false; StopTimeout(); if (!success) { OnError(base::nullopt); return; } - if (request_cont_fragments_.empty()) { - // The transaction wrote the full request frame. A response should follow - // soon after. - StartTimeout(); + if (!request_cont_fragments_.empty()) { + auto next_request_fragment = std::move(request_cont_fragments_.front()); + request_cont_fragments_.pop(); + WriteRequestFragment(next_request_fragment); return; } - auto next_request_fragment = std::move(request_cont_fragments_.front()); - request_cont_fragments_.pop(); - WriteRequestFragment(next_request_fragment); + // The transaction wrote the full request frame. It is possible that the full + // response frame was already received, at which point we process it and run + // the completim callback. + if (response_frame_assembler_ && response_frame_assembler_->IsDone()) { + ProcessResponseFrame(); + return; + } + + // Otherwise, a response should follow soon after. + StartTimeout(); } void FidoBleTransaction::OnResponseFragment(std::vector<uint8_t> data) { @@ -71,7 +90,7 @@ if (!response_frame_assembler_) { FidoBleFrameInitializationFragment fragment; if (!FidoBleFrameInitializationFragment::Parse(data, &fragment)) { - DLOG(ERROR) << "Malformed Frame Initialization Fragment"; + LOG(ERROR) << "Malformed Frame Initialization Fragment"; OnError(base::nullopt); return; } @@ -79,13 +98,12 @@ response_frame_assembler_.emplace(fragment); } else { FidoBleFrameContinuationFragment fragment; - if (!FidoBleFrameContinuationFragment::Parse(data, &fragment)) { - DLOG(ERROR) << "Malformed Frame Continuation Fragment"; + if (!FidoBleFrameContinuationFragment::Parse(data, &fragment) || + !response_frame_assembler_->AddFragment(fragment)) { + LOG(ERROR) << "Malformed Frame Continuation Fragment"; OnError(base::nullopt); return; } - - response_frame_assembler_->AddFragment(fragment); } if (!response_frame_assembler_->IsDone()) { @@ -94,12 +112,18 @@ return; } - FidoBleFrame frame = std::move(*response_frame_assembler_->GetFrame()); - response_frame_assembler_.reset(); - ProcessResponseFrame(std::move(frame)); + // It is possible to receive the last response fragment before the write of + // the last request fragment has been acknowledged. If this is the case, do + // not run the completion callback yet. + if (!has_pending_request_fragment_write_) + ProcessResponseFrame(); } -void FidoBleTransaction::ProcessResponseFrame(FidoBleFrame response_frame) { +void FidoBleTransaction::ProcessResponseFrame() { + DCHECK(response_frame_assembler_ && response_frame_assembler_->IsDone()); + auto response_frame = std::move(*response_frame_assembler_->GetFrame()); + response_frame_assembler_.reset(); + DCHECK(request_frame_.has_value()); if (response_frame.command() == request_frame_->command()) { request_frame_.reset(); @@ -108,19 +132,35 @@ } if (response_frame.command() == FidoBleDeviceCommand::kKeepAlive) { - DVLOG(2) << "CMD_KEEPALIVE: " - << static_cast<uint8_t>(response_frame.GetKeepaliveCode()); + if (!response_frame.IsValid()) { + LOG(ERROR) << "Got invald KeepAlive Command."; + OnError(base::nullopt); + return; + } + + VLOG(2) << "CMD_KEEPALIVE: " + << static_cast<int>(response_frame.GetKeepaliveCode()); // Expect another reponse frame soon. StartTimeout(); return; } - DCHECK_EQ(response_frame.command(), FidoBleDeviceCommand::kError); - DLOG(ERROR) << "CMD_ERROR: " - << static_cast<uint8_t>(response_frame.GetErrorCode()); - OnError(response_frame.IsValid() - ? base::make_optional(std::move(response_frame)) - : base::nullopt); + if (response_frame.command() == FidoBleDeviceCommand::kError) { + if (!response_frame.IsValid()) { + LOG(ERROR) << "Got invald Error Command."; + OnError(base::nullopt); + return; + } + + LOG(ERROR) << "CMD_ERROR: " + << static_cast<int>(response_frame.GetErrorCode()); + OnError(std::move(response_frame)); + return; + } + + LOG(ERROR) << "Got unexpected Command: " + << static_cast<int>(response_frame.command()); + OnError(base::nullopt); } void FidoBleTransaction::StartTimeout() { @@ -137,7 +177,9 @@ request_frame_.reset(); request_cont_fragments_ = base::queue<FidoBleFrameContinuationFragment>(); response_frame_assembler_.reset(); - std::move(callback_).Run(std::move(response_frame)); + // |callback_| might have been run due to a previous error. + if (callback_) + std::move(callback_).Run(std::move(response_frame)); } } // namespace device
diff --git a/device/fido/ble/fido_ble_transaction.h b/device/fido/ble/fido_ble_transaction.h index a2d585d..5d2b16e 100644 --- a/device/fido/ble/fido_ble_transaction.h +++ b/device/fido/ble/fido_ble_transaction.h
@@ -8,6 +8,7 @@ #include <memory> #include <vector> +#include "base/component_export.h" #include "base/containers/queue.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -22,7 +23,7 @@ // This class encapsulates logic related to a single U2F BLE request and // response. FidoBleTransaction is owned by FidoBleDevice, which is the only // class that should make use of this class. -class FidoBleTransaction { +class COMPONENT_EXPORT(DEVICE_FIDO) FidoBleTransaction { public: using FrameCallback = base::OnceCallback<void(base::Optional<FidoBleFrame>)>; @@ -36,7 +37,7 @@ private: void WriteRequestFragment(const FidoBleFrameFragment& fragment); void OnRequestFragmentWritten(bool success); - void ProcessResponseFrame(FidoBleFrame response_frame); + void ProcessResponseFrame(); void StartTimeout(); void StopTimeout(); @@ -54,6 +55,8 @@ std::vector<uint8_t> buffer_; base::OneShotTimer timer_; + bool has_pending_request_fragment_write_ = false; + base::WeakPtrFactory<FidoBleTransaction> weak_factory_; DISALLOW_COPY_AND_ASSIGN(FidoBleTransaction);
diff --git a/device/fido/ble/fido_ble_transaction_unittest.cc b/device/fido/ble/fido_ble_transaction_unittest.cc new file mode 100644 index 0000000..caab9fc --- /dev/null +++ b/device/fido/ble/fido_ble_transaction_unittest.cc
@@ -0,0 +1,337 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "device/fido/ble/fido_ble_transaction.h" + +#include <stdint.h> + +#include <utility> +#include <vector> + +#include "base/memory/ref_counted.h" +#include "base/optional.h" +#include "base/test/scoped_task_environment.h" +#include "base/threading/thread_task_runner_handle.h" +#include "device/bluetooth/test/bluetooth_test.h" +#include "device/bluetooth/test/mock_bluetooth_adapter.h" +#include "device/fido/ble/fido_ble_connection.h" +#include "device/fido/ble/fido_ble_frames.h" +#include "device/fido/ble/mock_fido_ble_connection.h" +#include "device/fido/fido_constants.h" +#include "device/fido/test_callback_receiver.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace device { + +namespace { + +constexpr uint16_t kDefaultControlPointLength = 20; + +using FrameCallbackReceiver = + test::ValueCallbackReceiver<base::Optional<FidoBleFrame>>; + +std::vector<std::vector<uint8_t>> ToByteFragments(const FidoBleFrame& frame) { + std::vector<std::vector<uint8_t>> byte_fragments; + auto fragments_pair = frame.ToFragments(kDefaultControlPointLength); + + byte_fragments.reserve(1 + fragments_pair.second.size()); + byte_fragments.emplace_back(); + byte_fragments.back().reserve(kDefaultControlPointLength); + fragments_pair.first.Serialize(&byte_fragments.back()); + + while (!fragments_pair.second.empty()) { + byte_fragments.emplace_back(); + byte_fragments.back().reserve(kDefaultControlPointLength); + fragments_pair.second.front().Serialize(&byte_fragments.back()); + fragments_pair.second.pop(); + } + + return byte_fragments; +} + +} // namespace + +class FidoBleTransactionTest : public ::testing::Test { + public: + base::test::ScopedTaskEnvironment& scoped_task_environment() { + return scoped_task_environment_; + } + MockFidoBleConnection& connection() { return connection_; } + FidoBleTransaction& transaction() { return *transaction_; } + + void ResetTransaction(uint16_t control_point_length) { + transaction_ = std::make_unique<FidoBleTransaction>(&connection_, + control_point_length); + } + + private: + base::test::ScopedTaskEnvironment scoped_task_environment_; + + scoped_refptr<BluetoothAdapter> adapter_ = + base::MakeRefCounted<::testing::NiceMock<MockBluetoothAdapter>>(); + MockFidoBleConnection connection_{adapter_.get(), + BluetoothTestBase::kTestDeviceAddress1}; + std::unique_ptr<FidoBleTransaction> transaction_ = + std::make_unique<FidoBleTransaction>(&connection_, + kDefaultControlPointLength); +}; + +// Tests a case where the control point write fails. +TEST_F(FidoBleTransactionTest, WriteRequestFrame_FailWrite) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillOnce(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(false /* success */); })); + + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(FidoBleFrame(), receiver.callback()); + receiver.WaitForCallback(); + EXPECT_EQ(base::nullopt, receiver.value()); +} + +// Tests a case where the control point write succeeds. +TEST_F(FidoBleTransactionTest, WriteRequestFrame_Success) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillOnce(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(true /* success */); })); + + FidoBleFrame frame(FidoBleDeviceCommand::kPing, std::vector<uint8_t>(10)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(frame, receiver.callback()); + + for (auto&& byte_fragment : ToByteFragments(frame)) + transaction().OnResponseFragment(std::move(byte_fragment)); + + receiver.WaitForCallback(); + EXPECT_EQ(frame, receiver.value()); +} + +// Tests a scenario where the full response frame is obtained before the control +// point write was acknowledged. The response callback should only be run once +// the ACK is received. +TEST_F(FidoBleTransactionTest, WriteRequestFrame_DelayedWriteAck) { + FidoBleConnection::WriteCallback delayed_write_callback; + + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillOnce(::testing::Invoke( + [&](auto&&, auto* cb) { delayed_write_callback = std::move(*cb); })); + + FidoBleFrame frame(FidoBleDeviceCommand::kPing, std::vector<uint8_t>(10)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(frame, receiver.callback()); + + for (auto&& byte_fragment : ToByteFragments(frame)) + transaction().OnResponseFragment(std::move(byte_fragment)); + + scoped_task_environment().RunUntilIdle(); + EXPECT_FALSE(receiver.was_called()); + + std::move(delayed_write_callback).Run(true); + receiver.WaitForCallback(); + EXPECT_EQ(frame, receiver.value()); +} + +// Tests a case where the control point length is too small. +TEST_F(FidoBleTransactionTest, WriteRequestFrame_ControlPointLength_TooSmall) { + static constexpr uint16_t kTooSmallControlPointLength = 2u; + ResetTransaction(kTooSmallControlPointLength); + + EXPECT_CALL(connection(), WriteControlPointPtr).Times(0); + FidoBleFrame frame(FidoBleDeviceCommand::kPing, std::vector<uint8_t>(10)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(frame, receiver.callback()); + + receiver.WaitForCallback(); + EXPECT_EQ(base::nullopt, receiver.value()); +} + +// Tests that valid KeepaliveCodes are ignored, and only a valid +// response frame completes the request. +TEST_F(FidoBleTransactionTest, WriteRequestFrame_IgnoreValidKeepAlives) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillOnce(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(true /* success */); })); + + FidoBleFrame frame(FidoBleDeviceCommand::kPing, std::vector<uint8_t>(10)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(frame, receiver.callback()); + + FidoBleFrame tup_needed_frame( + FidoBleDeviceCommand::kKeepAlive, + {base::strict_cast<uint8_t>(FidoBleFrame::KeepaliveCode::TUP_NEEDED)}); + for (auto&& byte_fragment : ToByteFragments(tup_needed_frame)) + transaction().OnResponseFragment(std::move(byte_fragment)); + + scoped_task_environment().RunUntilIdle(); + EXPECT_FALSE(receiver.was_called()); + + FidoBleFrame processing_frame( + FidoBleDeviceCommand::kKeepAlive, + {base::strict_cast<uint8_t>(FidoBleFrame::KeepaliveCode::PROCESSING)}); + for (auto&& byte_fragment : ToByteFragments(processing_frame)) + transaction().OnResponseFragment(std::move(byte_fragment)); + + scoped_task_environment().RunUntilIdle(); + EXPECT_FALSE(receiver.was_called()); + + for (auto&& byte_fragment : ToByteFragments(frame)) + transaction().OnResponseFragment(std::move(byte_fragment)); + + receiver.WaitForCallback(); + EXPECT_EQ(frame, receiver.value()); +} + +// Tests that an invalid KeepaliveCode is treated as an error. +TEST_F(FidoBleTransactionTest, WriteRequestFrame_InvalidKeepAlive_Fail) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillOnce(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(true /* success */); })); + + FidoBleFrame frame(FidoBleDeviceCommand::kPing, std::vector<uint8_t>(10)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(frame, receiver.callback()); + + // This frame is invalid, as it does not contain data. + FidoBleFrame keep_alive_frame(FidoBleDeviceCommand::kKeepAlive, {}); + for (auto&& byte_fragment : ToByteFragments(keep_alive_frame)) + transaction().OnResponseFragment(std::move(byte_fragment)); + + receiver.WaitForCallback(); + EXPECT_EQ(base::nullopt, receiver.value()); +} + +// Tests a scenario where the response frame contains a valid error command. +TEST_F(FidoBleTransactionTest, WriteRequestFrame_ValidErrorCommand) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillOnce(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(true /* success */); })); + + FidoBleFrame ping_frame(FidoBleDeviceCommand::kPing, + std::vector<uint8_t>(10)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(ping_frame, receiver.callback()); + + FidoBleFrame error_frame( + FidoBleDeviceCommand::kError, + {base::strict_cast<uint8_t>(FidoBleFrame::ErrorCode::INVALID_CMD)}); + + for (auto&& byte_fragment : ToByteFragments(error_frame)) + transaction().OnResponseFragment(std::move(byte_fragment)); + + receiver.WaitForCallback(); + EXPECT_EQ(error_frame, receiver.value()); +} + +// Tests a scenario where the response frame contains an invalid error command. +TEST_F(FidoBleTransactionTest, WriteRequestFrame_InvalidErrorCommand) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillOnce(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(true /* success */); })); + + FidoBleFrame ping_frame(FidoBleDeviceCommand::kPing, + std::vector<uint8_t>(10)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(ping_frame, receiver.callback()); + + // This frame is invalid, as it does not contain data. + FidoBleFrame error_frame(FidoBleDeviceCommand::kError, {}); + + for (auto&& byte_fragment : ToByteFragments(error_frame)) + transaction().OnResponseFragment(std::move(byte_fragment)); + + receiver.WaitForCallback(); + EXPECT_EQ(base::nullopt, receiver.value()); +} + +// Tests a scenario where the command of the response frame does not match the +// command of the request frame. +TEST_F(FidoBleTransactionTest, WriteRequestFrame_InvalidResponseFrameCommand) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillOnce(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(true /* success */); })); + + FidoBleFrame ping_frame(FidoBleDeviceCommand::kPing, + std::vector<uint8_t>(10)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(ping_frame, receiver.callback()); + + FidoBleFrame message_frame(FidoBleDeviceCommand::kMsg, + std::vector<uint8_t>(kDefaultControlPointLength)); + + for (auto&& byte_fragment : ToByteFragments(message_frame)) + transaction().OnResponseFragment(std::move(byte_fragment)); + + receiver.WaitForCallback(); + EXPECT_EQ(base::nullopt, receiver.value()); +} + +// Tests a scenario where the response initialization fragment is invalid. +TEST_F(FidoBleTransactionTest, + WriteRequestFrame_InvalidResponseInitializationFragment) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillRepeatedly(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(true /* success */); })); + + FidoBleFrame frame(FidoBleDeviceCommand::kPing, + std::vector<uint8_t>(kDefaultControlPointLength)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(frame, receiver.callback()); + + auto byte_fragments = ToByteFragments(frame); + ASSERT_EQ(2u, byte_fragments.size()); + transaction().OnResponseFragment(std::move(byte_fragments.back())); + transaction().OnResponseFragment(std::move(byte_fragments.front())); + + receiver.WaitForCallback(); + EXPECT_EQ(base::nullopt, receiver.value()); +} + +// Tests a scenario where a response continuation fragment is invalid. +TEST_F(FidoBleTransactionTest, + WriteRequestFrame_InvalidResponseContinuationFragment) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillRepeatedly(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(true /* success */); })); + + FidoBleFrame frame(FidoBleDeviceCommand::kPing, + std::vector<uint8_t>(kDefaultControlPointLength)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(frame, receiver.callback()); + + // Provide the initialization fragment twice. The second time should be an + // error, as it's not a valid continuation fragment. + auto byte_fragments = ToByteFragments(frame); + ASSERT_EQ(2u, byte_fragments.size()); + transaction().OnResponseFragment(byte_fragments.front()); + transaction().OnResponseFragment(byte_fragments.front()); + + receiver.WaitForCallback(); + EXPECT_EQ(base::nullopt, receiver.value()); +} + +// Tests a scenario where the order of response continuation fragments is +// invalid. +TEST_F(FidoBleTransactionTest, + WriteRequestFrame_InvalidOrderResponseContinuationFragments) { + EXPECT_CALL(connection(), WriteControlPointPtr) + .WillRepeatedly(::testing::Invoke( + [](auto&&, auto* cb) { std::move(*cb).Run(true /* success */); })); + + FidoBleFrame frame(FidoBleDeviceCommand::kPing, + std::vector<uint8_t>(kDefaultControlPointLength * 2)); + FrameCallbackReceiver receiver; + transaction().WriteRequestFrame(frame, receiver.callback()); + + // Provide the continuation fragments in the wrong order. + auto byte_fragments = ToByteFragments(frame); + ASSERT_EQ(3u, byte_fragments.size()); + transaction().OnResponseFragment(byte_fragments[0]); + transaction().OnResponseFragment(byte_fragments[2]); + transaction().OnResponseFragment(byte_fragments[1]); + + receiver.WaitForCallback(); + EXPECT_EQ(base::nullopt, receiver.value()); +} + +} // namespace device
diff --git a/docs/chromedriver_status.md b/docs/chromedriver_status.md index 9f52a1e9..73f8b5f 100644 --- a/docs/chromedriver_status.md +++ b/docs/chromedriver_status.md
@@ -33,7 +33,7 @@ | POST | /session/{session id}/element/{element id}/elements | Find Elements From Element | | | GET | /session/{session id}/element/{element id}/selected | Is Element Selected | | | GET | /session/{session id}/element/{element id}/attribute/{name} | Get Element Attribute | | -| GET | /session/{session id}/element/{element id}/property/{name} | Get Element Property | Incomplete | [1936](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1936) +| GET | /session/{session id}/element/{element id}/property/{name} | Get Element Property | Complete | | GET | /session/{session id}/element/{element id}/css/{property name} | Get Element CSS Value | Partially Complete | [1994](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1994) | GET | /session/{session id}/element/{element id}/text | Get Element Text | Complete | | GET | /session/{session id}/element/{element id}/name | Get Element Tag Name | Complete |
diff --git a/extensions/browser/device_local_account_util.cc b/extensions/browser/device_local_account_util.cc index 6f83f202..6b14c941 100644 --- a/extensions/browser/device_local_account_util.cc +++ b/extensions/browser/device_local_account_util.cc
@@ -101,6 +101,7 @@ // New demo mode: "lpmakjfjcconjeehbidjclhdlpjmfjjj", // Highlights app "iggildboghmjpbjcpmobahnkmoefkike", // Highlights app + "mnoijifedipmbjaoekhadjcijipaijjc", // Screensaver // Testing extensions: "ongnjlefhnoajpbodoldndkbkdgfomlp", // Show Managed Storage
diff --git a/extensions/browser/extensions_browser_client.cc b/extensions/browser/extensions_browser_client.cc index 8658efe..adf2c97 100644 --- a/extensions/browser/extensions_browser_client.cc +++ b/extensions/browser/extensions_browser_client.cc
@@ -98,8 +98,4 @@ return nullptr; } -UserScriptListener* ExtensionsBrowserClient::GetUserScriptListener() { - return nullptr; -} - } // namespace extensions
diff --git a/extensions/browser/extensions_browser_client.h b/extensions/browser/extensions_browser_client.h index 4afefce..7e0c178e 100644 --- a/extensions/browser/extensions_browser_client.h +++ b/extensions/browser/extensions_browser_client.h
@@ -74,7 +74,6 @@ class ProcessManagerDelegate; class ProcessMap; class RuntimeAPIDelegate; -class UserScriptListener; // Interface to allow the extensions module to make browser-process-specific // queries of the embedder. Should be Set() once in the browser process. @@ -356,8 +355,6 @@ virtual network::mojom::NetworkContext* GetSystemNetworkContext(); - virtual UserScriptListener* GetUserScriptListener(); - private: std::vector<std::unique_ptr<ExtensionsBrowserAPIProvider>> providers_;
diff --git a/extensions/common/constants.cc b/extensions/common/constants.cc index 8993781b..d2dcc8c7 100644 --- a/extensions/common/constants.cc +++ b/extensions/common/constants.cc
@@ -119,6 +119,7 @@ const char kHighlightsAppId[] = "lpmakjfjcconjeehbidjclhdlpjmfjjj"; const char kHighlightsAlt1AppId[] = "iggildboghmjpbjcpmobahnkmoefkike"; const char kHighlightsAlt2AppId[] = "elhbopodaklenjkeihkdhhfaghalllba"; +const char kScreensaverAppId[] = "mnoijifedipmbjaoekhadjcijipaijjc"; #endif const char kProdHangoutsExtensionId[] = "nckgahadagoaajjgafhacjanaoiihapd";
diff --git a/extensions/common/constants.h b/extensions/common/constants.h index a2824e59..ca1d8518 100644 --- a/extensions/common/constants.h +++ b/extensions/common/constants.h
@@ -254,6 +254,9 @@ // The extension id of an alternate Demo Mode Highlights app. extern const char kHighlightsAlt2AppId[]; + +// The extension id of the default Demo Mode screensaver app. +extern const char kScreensaverAppId[]; #endif // The extension id for the production version of Hangouts.
diff --git a/gpu/command_buffer/common/BUILD.gn b/gpu/command_buffer/common/BUILD.gn index 7b419f4..d151d82 100644 --- a/gpu/command_buffer/common/BUILD.gn +++ b/gpu/command_buffer/common/BUILD.gn
@@ -87,6 +87,8 @@ "mailbox_holder.h", "scheduling_priority.cc", "scheduling_priority.h", + "shared_image_trace_utils.cc", + "shared_image_trace_utils.h", "shared_image_usage.h", "swap_buffers_complete_params.cc", "swap_buffers_complete_params.h",
diff --git a/gpu/command_buffer/common/shared_image_trace_utils.cc b/gpu/command_buffer/common/shared_image_trace_utils.cc new file mode 100644 index 0000000..d482a1e --- /dev/null +++ b/gpu/command_buffer/common/shared_image_trace_utils.cc
@@ -0,0 +1,18 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gpu/command_buffer/common/shared_image_trace_utils.h" + +#include "base/strings/stringprintf.h" +#include "gpu/command_buffer/common/mailbox.h" + +namespace gpu { + +base::trace_event::MemoryAllocatorDumpGuid GetSharedImageGUIDForTracing( + const Mailbox& mailbox) { + return base::trace_event::MemoryAllocatorDumpGuid(base::StringPrintf( + "gpu-shared-image/%s", mailbox.ToDebugString().c_str())); +} + +} // namespace gpu
diff --git a/gpu/command_buffer/common/shared_image_trace_utils.h b/gpu/command_buffer/common/shared_image_trace_utils.h new file mode 100644 index 0000000..6562a5e --- /dev/null +++ b/gpu/command_buffer/common/shared_image_trace_utils.h
@@ -0,0 +1,20 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef GPU_COMMAND_BUFFER_COMMON_SHARED_IMAGE_TRACE_UTILS_H_ +#define GPU_COMMAND_BUFFER_COMMON_SHARED_IMAGE_TRACE_UTILS_H_ + +#include "base/trace_event/memory_allocator_dump.h" +#include "gpu/gpu_export.h" + +namespace gpu { + +struct Mailbox; + +GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid +GetSharedImageGUIDForTracing(const Mailbox& mailbox); + +} // namespace gpu + +#endif // GPU_COMMAND_BUFFER_COMMON_SHARED_IMAGE_TRACE_UTILS_H_
diff --git a/gpu/command_buffer/service/shared_image_factory.cc b/gpu/command_buffer/service/shared_image_factory.cc index 6076e4f..44ab8cf 100644 --- a/gpu/command_buffer/service/shared_image_factory.cc +++ b/gpu/command_buffer/service/shared_image_factory.cc
@@ -4,8 +4,13 @@ #include "gpu/command_buffer/service/shared_image_factory.h" +#include <inttypes.h> + +#include "base/strings/stringprintf.h" +#include "base/trace_event/memory_dump_manager.h" #include "components/viz/common/resources/resource_format_utils.h" #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" +#include "gpu/command_buffer/common/shared_image_trace_utils.h" #include "gpu/command_buffer/common/shared_image_usage.h" #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/command_buffer/service/image_factory.h" @@ -16,6 +21,7 @@ #include "ui/gfx/color_space.h" #include "ui/gfx/geometry/size.h" #include "ui/gl/gl_bindings.h" +#include "ui/gl/trace_util.h" namespace gpu { @@ -149,7 +155,7 @@ return false; } - GLenum target = use_buffer ? GL_TEXTURE_2D : format_info.target_for_scanout; + GLenum target = use_buffer ? format_info.target_for_scanout : GL_TEXTURE_2D; GLenum get_target = GL_TEXTURE_BINDING_2D; switch (target) { @@ -237,7 +243,10 @@ gles2::Texture* texture = new gles2::Texture(service_id); texture->SetLightweightRef(memory_tracker_.get()); texture->SetTarget(target, 1); - texture->SetLevelInfo(target, 0, internal_format, size.width(), + // TODO(piman): We pretend the texture was created in an ES2 context, so + // that it can be used in other ES2 contexts, and so we have to pass + // gl_format as the internal format. https://crbug.com/628064 + texture->SetLevelInfo(target, 0, format_info.gl_format, size.width(), size.height(), 1, 0, format_info.gl_format, format_info.gl_type, cleared_rect); if (format_info.swizzle) @@ -294,6 +303,52 @@ mailboxes_.clear(); } +bool SharedImageFactory::OnMemoryDump( + const base::trace_event::MemoryDumpArgs& args, + base::trace_event::ProcessMemoryDump* pmd, + int client_id, + uint64_t client_tracing_id) { + if (use_passthrough_) + return false; + for (const auto& mailbox : mailboxes_) { + auto* texture = + static_cast<gles2::Texture*>(mailbox_manager_->ConsumeTexture(mailbox)); + DCHECK(texture); + + // Unique name in the process. + std::string dump_name = + base::StringPrintf("gpu/shared-images/client_0x%" PRIX32 "/mailbox_%s", + client_id, mailbox.ToDebugString().c_str()); + + base::trace_event::MemoryAllocatorDump* dump = + pmd->CreateAllocatorDump(dump_name); + dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, + base::trace_event::MemoryAllocatorDump::kUnitsBytes, + static_cast<uint64_t>(texture->estimated_size())); + // Add a mailbox guid which expresses shared ownership with the client + // process. + // This must match the client-side. + auto client_guid = GetSharedImageGUIDForTracing(mailbox); + pmd->CreateSharedGlobalAllocatorDump(client_guid); + pmd->AddOwnershipEdge(dump->guid(), client_guid); + // Add a |service_guid| which expresses shared ownership between the various + // GPU dumps. + auto service_guid = + gl::GetGLTextureServiceGUIDForTracing(texture->service_id()); + pmd->CreateSharedGlobalAllocatorDump(service_guid); + // TODO(piman): coalesce constant with TextureManager::DumpTextureRef. + int importance = 2; // This client always owns the ref. + + pmd->AddOwnershipEdge(client_guid, service_guid, importance); + + // Dump all sub-levels held by the texture. They will appear below the main + // gl/textures/client_X/mailbox_Y dump. + texture->DumpLevelMemory(pmd, client_tracing_id, dump_name); + } + + return true; +} + SharedImageFactory::FormatInfo::FormatInfo() = default; SharedImageFactory::FormatInfo::~FormatInfo() = default;
diff --git a/gpu/command_buffer/service/shared_image_factory.h b/gpu/command_buffer/service/shared_image_factory.h index d03a9a3e..8450051 100644 --- a/gpu/command_buffer/service/shared_image_factory.h +++ b/gpu/command_buffer/service/shared_image_factory.h
@@ -54,6 +54,10 @@ bool DestroySharedImage(const Mailbox& mailbox); bool HasImages() const { return !mailboxes_.empty(); } void DestroyAllSharedImages(bool have_context); + bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, + base::trace_event::ProcessMemoryDump* pmd, + int client_id, + uint64_t client_tracing_id); private: struct FormatInfo {
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc index 97081b14..0556e350 100644 --- a/gpu/command_buffer/service/texture_manager.cc +++ b/gpu/command_buffer/service/texture_manager.cc
@@ -3550,7 +3550,8 @@ int importance = 0; // Default importance. // The link to the memory tracking |client_id| is given a higher importance // than other refs. - if (ref == ref->texture()->memory_tracking_ref_) + if (!ref->texture()->lightweight_ref_ && + (ref == ref->texture()->memory_tracking_ref_)) importance = 2; pmd->AddOwnershipEdge(client_guid, service_guid, importance);
diff --git a/gpu/config/gpu_driver_bug_list.json b/gpu/config/gpu_driver_bug_list.json index 0366e85..3c70907 100644 --- a/gpu/config/gpu_driver_bug_list.json +++ b/gpu/config/gpu_driver_bug_list.json
@@ -2616,13 +2616,16 @@ }, { "id": 249, - "description": "Direct composition causes slow presents on old Nvidia GPUs", - "cr_bugs": [775898], + "description": "Direct composition isn't needed except for Intel GPUs", + "cr_bugs": [775898, 800950], "os": { "type": "win" }, - "vendor_id": "0x10de", - "device_id": ["0x10d8"], + "exceptions": [ + { + "vendor_id": "0x8086" + } + ], "features": [ "disable_direct_composition" ]
diff --git a/gpu/ipc/client/gpu_channel_host.cc b/gpu/ipc/client/gpu_channel_host.cc index cb8d459..6ecc095 100644 --- a/gpu/ipc/client/gpu_channel_host.cc +++ b/gpu/ipc/client/gpu_channel_host.cc
@@ -40,7 +40,11 @@ gpu_info_(gpu_info), gpu_feature_info_(gpu_feature_info), listener_(new Listener(std::move(handle), io_thread_), - base::OnTaskRunnerDeleter(io_thread_)) { + base::OnTaskRunnerDeleter(io_thread_)), + shared_image_interface_( + this, + static_cast<int32_t>( + GpuChannelReservedRoutes::kSharedImageInterface)) { next_image_id_.GetNext(); for (int32_t i = 0; i <= static_cast<int32_t>(GpuChannelReservedRoutes::kMaxValue); ++i)
diff --git a/gpu/ipc/client/gpu_channel_host.h b/gpu/ipc/client/gpu_channel_host.h index 261ae2ee..689c1be 100644 --- a/gpu/ipc/client/gpu_channel_host.h +++ b/gpu/ipc/client/gpu_channel_host.h
@@ -24,6 +24,7 @@ #include "gpu/config/gpu_feature_info.h" #include "gpu/config/gpu_info.h" #include "gpu/gpu_export.h" +#include "gpu/ipc/client/shared_image_interface_proxy.h" #include "ipc/ipc_channel_handle.h" #include "ipc/message_filter.h" #include "ipc/message_router.h" @@ -145,6 +146,10 @@ // otherwise ignored. void CrashGpuProcessForTesting(); + SharedImageInterface* shared_image_interface() { + return &shared_image_interface_; + } + protected: friend class base::RefCountedThreadSafe<GpuChannelHost>; ~GpuChannelHost() override; @@ -246,6 +251,8 @@ // with base::Unretained(listener_). std::unique_ptr<Listener, base::OnTaskRunnerDeleter> listener_; + SharedImageInterfaceProxy shared_image_interface_; + // Image IDs are allocated in sequence. base::AtomicSequenceNumber next_image_id_;
diff --git a/gpu/ipc/gl_in_process_context.cc b/gpu/ipc/gl_in_process_context.cc index 0c1509d..02deb69 100644 --- a/gpu/ipc/gl_in_process_context.cc +++ b/gpu/ipc/gl_in_process_context.cc
@@ -48,6 +48,10 @@ return gles2_implementation_.get(); } +SharedImageInterface* GLInProcessContext::GetSharedImageInterface() { + return command_buffer_->GetSharedImageInterface(); +} + ContextResult GLInProcessContext::Initialize( scoped_refptr<CommandBufferTaskExecutor> task_executor, scoped_refptr<gl::GLSurface> surface,
diff --git a/gpu/ipc/gl_in_process_context.h b/gpu/ipc/gl_in_process_context.h index ac406d1..b76cfa6 100644 --- a/gpu/ipc/gl_in_process_context.h +++ b/gpu/ipc/gl_in_process_context.h
@@ -16,6 +16,7 @@ #include "ui/gl/gl_surface.h" namespace gpu { +class SharedImageInterface; class TransferBuffer; struct GpuFeatureInfo; struct SharedMemoryLimits; @@ -58,6 +59,8 @@ // can be used without making it current. gles2::GLES2Implementation* GetImplementation(); + SharedImageInterface* GetSharedImageInterface(); + private: // The destruction order is important, don't reorder these member variables. std::unique_ptr<InProcessCommandBuffer> command_buffer_;
diff --git a/gpu/ipc/service/shared_image_stub.cc b/gpu/ipc/service/shared_image_stub.cc index 0771b677..78c8a38 100644 --- a/gpu/ipc/service/shared_image_stub.cc +++ b/gpu/ipc/service/shared_image_stub.cc
@@ -4,6 +4,9 @@ #include "gpu/ipc/service/shared_image_stub.h" +#include <inttypes.h> + +#include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/trace_event.h" #include "gpu/command_buffer/service/scheduler.h" #include "gpu/command_buffer/service/shared_image_factory.h" @@ -24,7 +27,10 @@ CommandBufferNamespace::GPU_IO, CommandBufferIdFromChannelAndRoute(channel->client_id(), route_id), - sequence_)) {} + sequence_)) { + base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( + this, "gpu::SharedImageStub", channel_->task_runner()); +} SharedImageStub::~SharedImageStub() { channel_->scheduler()->DestroySequence(sequence_); @@ -33,6 +39,8 @@ bool have_context = MakeContextCurrentAndCreateFactory(); factory_->DestroyAllSharedImages(have_context); } + base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( + this); } bool SharedImageStub::OnMessageReceived(const IPC::Message& msg) { @@ -86,7 +94,11 @@ } DCHECK(context_state_); DCHECK(!context_state_->context_lost); - DCHECK(context_state_->context->IsCurrent(nullptr)); + if (!context_state_->context->MakeCurrent(context_state_->surface.get())) { + LOG(ERROR) << "SharedImageStub: MakeCurrent failed"; + OnError(); + return false; + } gpu::GpuMemoryBufferFactory* gmb_factory = channel_manager->gpu_memory_buffer_factory(); factory_ = std::make_unique<SharedImageFactory>( @@ -136,4 +148,26 @@ return sync_point_client_state_->command_buffer_id().GetUnsafeValue(); } +bool SharedImageStub::OnMemoryDump( + const base::trace_event::MemoryDumpArgs& args, + base::trace_event::ProcessMemoryDump* pmd) { + if (!factory_) + return true; + + if (args.level_of_detail == + base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) { + std::string dump_name = + base::StringPrintf("gpu/gl/textures/client_0x%" PRIX32, ClientId()); + base::trace_event::MemoryAllocatorDump* dump = + pmd->CreateAllocatorDump(dump_name); + dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, + base::trace_event::MemoryAllocatorDump::kUnitsBytes, size_); + + // Early out, no need for more detail in a BACKGROUND dump. + return true; + } + + return factory_->OnMemoryDump(args, pmd, ClientId(), ClientTracingId()); +} + } // namespace gpu
diff --git a/gpu/ipc/service/shared_image_stub.h b/gpu/ipc/service/shared_image_stub.h index 67807964..b1493860 100644 --- a/gpu/ipc/service/shared_image_stub.h +++ b/gpu/ipc/service/shared_image_stub.h
@@ -5,6 +5,7 @@ #ifndef GPU_IPC_SERVICE_SHARED_IMAGE_STUB_H_ #define GPU_IPC_SERVICE_SHARED_IMAGE_STUB_H_ +#include "base/trace_event/memory_dump_provider.h" #include "components/viz/common/resources/resource_format.h" #include "gpu/command_buffer/service/memory_tracking.h" #include "gpu/command_buffer/service/sync_point_manager.h" @@ -21,7 +22,9 @@ struct RasterDecoderContextState; } -class SharedImageStub : public IPC::Listener, public gles2::MemoryTracker { +class SharedImageStub : public IPC::Listener, + public gles2::MemoryTracker, + public base::trace_event::MemoryDumpProvider { public: SharedImageStub(GpuChannel* channel, int32_t route_id); ~SharedImageStub() override; @@ -29,13 +32,17 @@ // IPC::Listener implementation: bool OnMessageReceived(const IPC::Message& msg) override; - // gles2::MemoryTracker implementation; + // gles2::MemoryTracker implementation: void TrackMemoryAllocatedChange(uint64_t delta) override; uint64_t GetSize() const override; uint64_t ClientTracingId() const override; int ClientId() const override; uint64_t ContextGroupTracingId() const override; + // base::trace_event::MemoryDumpProvider implementation: + bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, + base::trace_event::ProcessMemoryDump* pmd) override; + SequenceId sequence() const { return sequence_; } private:
diff --git a/gpu/vulkan/features.gni b/gpu/vulkan/features.gni index 1c11576f..3214adbae 100644 --- a/gpu/vulkan/features.gni +++ b/gpu/vulkan/features.gni
@@ -8,7 +8,7 @@ # For details see declare_args() in build/config/BUILDCONFIG.gn. declare_args() { # Enable experimental vulkan backend. - enable_vulkan = (is_linux && use_x11) || is_android + enable_vulkan = is_linux || is_android # We want to temporarily disable Vulkan on Android to give us time to # investigate ways to reduce its binary size.
diff --git a/gpu/vulkan/init/vulkan_factory.cc b/gpu/vulkan/init/vulkan_factory.cc index 9a982967..fd27ac3 100644 --- a/gpu/vulkan/init/vulkan_factory.cc +++ b/gpu/vulkan/init/vulkan_factory.cc
@@ -12,7 +12,7 @@ #endif #if defined(USE_X11) -#include "gpu/vulkan/x/vulkan_implementation_x11.h" +#include "gpu/vulkan/x/vulkan_implementation_x11.h" // nogncheck #endif #if defined(USE_OZONE)
diff --git a/headless/test/data/protocol/emulation/virtual-time-interrupt-expected.txt b/headless/test/data/protocol/emulation/virtual-time-interrupt-expected.txt new file mode 100644 index 0000000..4e7e6e1 --- /dev/null +++ b/headless/test/data/protocol/emulation/virtual-time-interrupt-expected.txt
@@ -0,0 +1,2 @@ +Tests that virtual time fence does not block interrupting protocol commands. +Returned from the Performance.getMetrics call. \ No newline at end of file
diff --git a/headless/test/data/protocol/emulation/virtual-time-interrupt.js b/headless/test/data/protocol/emulation/virtual-time-interrupt.js new file mode 100644 index 0000000..b98c3a46 --- /dev/null +++ b/headless/test/data/protocol/emulation/virtual-time-interrupt.js
@@ -0,0 +1,22 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +(async function(testRunner) { + var {page, session, dp} = await testRunner.startBlank( + 'Tests that virtual time fence does not block interrupting protocol' + + ' commands.'); + + await dp.Emulation.setVirtualTimePolicy({policy: 'pause'}); + await dp.Emulation.setVirtualTimePolicy({ + policy: 'pauseIfNetworkFetchesPending', + budget: 1000, waitForNavigation: true}); + await dp.Performance.enable(); + dp.Page.navigate({url: testRunner.url('/resources/blank.html')}); + + await dp.Emulation.onceVirtualTimeBudgetExpired(); + await dp.Performance.getMetrics(); + // Should pass. + testRunner.log('Returned from the Performance.getMetrics call.'); + testRunner.completeTest(); +})
diff --git a/headless/test/headless_protocol_browsertest.cc b/headless/test/headless_protocol_browsertest.cc index 2439bd4..fc46e13 100644 --- a/headless/test/headless_protocol_browsertest.cc +++ b/headless/test/headless_protocol_browsertest.cc
@@ -199,6 +199,8 @@ // Headless-specific tests HEADLESS_PROTOCOL_TEST(VirtualTimeAdvance, "emulation/virtual-time-advance.js"); HEADLESS_PROTOCOL_TEST(VirtualTimeBasics, "emulation/virtual-time-basics.js"); +HEADLESS_PROTOCOL_TEST(VirtualTimeInterrupt, + "emulation/virtual-time-interrupt.js"); HEADLESS_PROTOCOL_TEST(VirtualTimeCrossProcessNavigation, "emulation/virtual-time-cross-process-navigation.js"); HEADLESS_PROTOCOL_TEST(VirtualTimeDetachFrame,
diff --git a/ios/build/bots/chromium.webrtc.fyi.experimental/WebRTC Chromium FYI ios-device.json b/ios/build/bots/chromium.webrtc.fyi.experimental/WebRTC Chromium FYI ios-device.json new file mode 100644 index 0000000..a46d34d --- /dev/null +++ b/ios/build/bots/chromium.webrtc.fyi.experimental/WebRTC Chromium FYI ios-device.json
@@ -0,0 +1,23 @@ +{ + "comments": [ + "Builder for 32-bit devices.", + "Build is performed with gn+ninja.", + "TODO(crbug.com/877018): graduate to chromium.webrtc.fyi when it works." + ], + "xcode build version": "10a254a", + "gn_args": [ + "additional_target_cpus=[ \"arm64\" ]", + "goma_dir=\"$(goma_dir)\"", + "ios_enable_code_signing=false", + "is_component_build=false", + "is_debug=false", + "target_cpu=\"arm\"", + "target_os=\"ios\"", + "use_goma=true" + ], + "additional_compile_targets": [ + "all" + ], + "tests": [ + ] +}
diff --git a/ios/build/bots/chromium.webrtc.fyi.experimental/WebRTC Chromium FYI ios-simulator.json b/ios/build/bots/chromium.webrtc.fyi.experimental/WebRTC Chromium FYI ios-simulator.json new file mode 100644 index 0000000..8aaa591 --- /dev/null +++ b/ios/build/bots/chromium.webrtc.fyi.experimental/WebRTC Chromium FYI ios-simulator.json
@@ -0,0 +1,65 @@ +{ + "comments": [ + "Runs tests on @3x, @2x, 64-bit, 32-bit, phone, tablet, iOS 10, and iOS 9.", + "TODO(crbug.com/877018): graduate to chromium.webrtc.fyi when it works." + ], + "xcode build version": "10a254a", + "gn_args": [ + "additional_target_cpus=[\"x86\"]", + "goma_dir=\"$(goma_dir)\"", + "ios_enable_code_signing=false", + "is_component_build=false", + "is_debug=true", + "symbol_level=1", + "target_cpu=\"x64\"", + "target_os=\"ios\"", + "use_goma=true" + ], + "additional_compile_targets": [ + "all" + ], + "configuration": "Debug", + "sdk": "iphonesimulator10.0", + "tests": [ + { + "include": "common_tests.json", + "device type": "iPhone 6s Plus", + "os": "10.0" + }, + { + "include": "common_tests.json", + "device type": "iPhone 6s", + "os": "10.0" + }, + { + "include": "common_tests.json", + "device type": "iPhone 5", + "os": "10.0" + }, + { + "include": "common_tests.json", + "device type": "iPad Air 2", + "os": "10.0" + }, + { + "include": "common_tests.json", + "device type": "iPad Retina", + "os": "10.0" + }, + { + "include": "common_tests.json", + "device type": "iPhone 5", + "comments": [ + "This still relies on system iOS 9.0 legacy simulators,", + "since Xcode 8.0 doesn't provide it. But our test runner", + "doesn't support Xcode 7.0 anymore..." + ], + "os": "9.0" + }, + { + "include": "common_tests.json", + "device type": "iPad Air 2", + "os": "9.0" + } + ] +}
diff --git a/ios/chrome/browser/about_flags.mm b/ios/chrome/browser/about_flags.mm index d2f7a0b..ee8785af 100644 --- a/ios/chrome/browser/about_flags.mm +++ b/ios/chrome/browser/about_flags.mm
@@ -384,6 +384,9 @@ {"toolbar-container", flag_descriptions::kToolbarContainerName, flag_descriptions::kToolbarContainerDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(toolbar_container::kToolbarContainerEnabled)}, + {"omnibox-popup-shortcuts", flag_descriptions::kOmniboxPopupShortcutsName, + flag_descriptions::kOmniboxPopupShortcutsDescription, flags_ui::kOsIos, + FEATURE_VALUE_TYPE(kOmniboxPopupShortcuts)}, {"sso-with-wkwebview", flag_descriptions::kSSOWithWKWebViewName, flag_descriptions::kSSOWithWKWebViewDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(kSSOWithWKWebView)},
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/ios_chrome_flag_descriptions.cc index 41a9323..e851885 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.cc +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.cc
@@ -208,6 +208,11 @@ "currently under development. WARNING: when enabled Password Manager might " "stop working"; +const char kOmniboxPopupShortcutsName[] = "Show zero-state omnibox shortcuts"; +const char kOmniboxPopupShortcutsDescription[] = + "Instead of ZeroSuggest, show most visited sites and collection shortcuts " + "in the omnibox popup."; + const char kOmniboxUIElideSuggestionUrlAfterHostName[] = "Hide the path, query, and ref of omnibox suggestions"; const char kOmniboxUIElideSuggestionUrlAfterHostDescription[] =
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.h b/ios/chrome/browser/ios_chrome_flag_descriptions.h index 4c81ce9..5e1c766 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.h +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.h
@@ -170,6 +170,11 @@ extern const char kNewPasswordFormParsingName[]; extern const char kNewPasswordFormParsingDescription[]; +// Title and description for the flag to show most visited sites and collection +// shortcuts in the omnibox popup instead of ZeroSuggest. +extern const char kOmniboxPopupShortcutsName[]; +extern const char kOmniboxPopupShortcutsDescription[]; + // Title and description for the flag to enable elision of the URL path, query, // and ref in omnibox URL suggestions. extern const char kOmniboxUIElideSuggestionUrlAfterHostName[];
diff --git a/ios/chrome/browser/snapshots/snapshot_cache.mm b/ios/chrome/browser/snapshots/snapshot_cache.mm index 01f5cb4..e0056cdb 100644 --- a/ios/chrome/browser/snapshots/snapshot_cache.mm +++ b/ios/chrome/browser/snapshots/snapshot_cache.mm
@@ -370,7 +370,7 @@ [lruCache_ setObject:image forKey:sessionID]; - [self.observers snapshotCache:self didUpdateSnapshotForTab:sessionID]; + [self.observers snapshotCache:self didUpdateSnapshotForIdentifier:sessionID]; // Copy ivars used by the block so that it does not reference |self|. const base::FilePath cacheDirectory = cacheDirectory_; @@ -392,6 +392,8 @@ [lruCache_ removeObjectForKey:sessionID]; + [self.observers snapshotCache:self didUpdateSnapshotForIdentifier:sessionID]; + if (!taskRunner_) return;
diff --git a/ios/chrome/browser/snapshots/snapshot_cache_observer.h b/ios/chrome/browser/snapshots/snapshot_cache_observer.h index 9294bfb..34788b2 100644 --- a/ios/chrome/browser/snapshots/snapshot_cache_observer.h +++ b/ios/chrome/browser/snapshots/snapshot_cache_observer.h
@@ -12,10 +12,10 @@ // Interface for listening to events occurring to the SnapshotCache. @protocol SnapshotCacheObserver @optional -// Tells the observing object that the |snapshot_cache| was updated with a new -// snapshot for |tab_id|. +// Tells the observing object that the |snapshotCache| was updated with a new +// snapshot corresponding to |identifier|. - (void)snapshotCache:(SnapshotCache*)snapshotCache - didUpdateSnapshotForTab:(NSString*)tabID; + didUpdateSnapshotForIdentifier:(NSString*)identifier; @end #endif // IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_CACHE_OBSERVER_H_
diff --git a/ios/chrome/browser/snapshots/snapshot_cache_unittest.mm b/ios/chrome/browser/snapshots/snapshot_cache_unittest.mm index f675ac5..f23be4dc 100644 --- a/ios/chrome/browser/snapshots/snapshot_cache_unittest.mm +++ b/ios/chrome/browser/snapshots/snapshot_cache_unittest.mm
@@ -16,6 +16,7 @@ #include "base/task/task_scheduler/task_scheduler.h" #include "base/time/time.h" #import "ios/chrome/browser/snapshots/snapshot_cache_internal.h" +#import "ios/chrome/browser/snapshots/snapshot_cache_observer.h" #include "ios/web/public/test/test_web_thread_bundle.h" #include "ios/web/public/web_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -29,6 +30,18 @@ static const NSUInteger kSessionCount = 10; static const NSUInteger kSnapshotPixelSize = 8; +@interface FakeSnapshotCacheObserver : NSObject<SnapshotCacheObserver> +@property(nonatomic, copy) NSString* lastUpdatedIdentifier; +@end + +@implementation FakeSnapshotCacheObserver +@synthesize lastUpdatedIdentifier = _lastUpdatedIdentifier; +- (void)snapshotCache:(SnapshotCache*)snapshotCache + didUpdateSnapshotForIdentifier:(NSString*)identifier { + self.lastUpdatedIdentifier = identifier; +} +@end + namespace { class SnapshotCacheTest : public PlatformTest { @@ -614,4 +627,20 @@ EXPECT_TRUE(base::PathExists(image_path)); } +// Tests that observers are notified when a snapshot is cached and removed. +TEST_F(SnapshotCacheTest, ObserversNotifiedOnSetAndRemoveImage) { + SnapshotCache* cache = GetSnapshotCache(); + FakeSnapshotCacheObserver* observer = + [[FakeSnapshotCacheObserver alloc] init]; + [cache addObserver:observer]; + EXPECT_NSEQ(nil, observer.lastUpdatedIdentifier); + UIImage* image = [testImages_ objectAtIndex:0]; + NSString* sessionID = [testSessions_ objectAtIndex:0]; + [cache setImage:image withSessionID:sessionID]; + EXPECT_NSEQ(sessionID, observer.lastUpdatedIdentifier); + observer.lastUpdatedIdentifier = nil; + [cache removeImageWithSessionID:sessionID]; + EXPECT_NSEQ(sessionID, observer.lastUpdatedIdentifier); + [cache removeObserver:observer]; +} } // namespace
diff --git a/ios/chrome/browser/ui/BUILD.gn b/ios/chrome/browser/ui/BUILD.gn index 2b698573..5df9d8d0 100644 --- a/ios/chrome/browser/ui/BUILD.gn +++ b/ios/chrome/browser/ui/BUILD.gn
@@ -378,6 +378,7 @@ "//ios/chrome/browser/ui/ntp", "//ios/chrome/browser/ui/ntp:ntp_controller", "//ios/chrome/browser/ui/ntp:ntp_internal", + "//ios/chrome/browser/ui/ntp:util", "//ios/chrome/browser/ui/ntp/recent_tabs", "//ios/chrome/browser/ui/omnibox:omnibox_internal", "//ios/chrome/browser/ui/overscroll_actions",
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index c0479beb0..58a8329 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -170,6 +170,7 @@ #import "ios/chrome/browser/ui/main_content/main_content_ui_state.h" #import "ios/chrome/browser/ui/main_content/web_scroll_view_main_content_ui_forwarder.h" #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" +#import "ios/chrome/browser/ui/ntp/ntp_util.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_handset_coordinator.h" #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.h" #import "ios/chrome/browser/ui/page_info/page_info_legacy_coordinator.h" @@ -4107,6 +4108,10 @@ #pragma mark - ToolbarHeightProviderForFullscreen - (CGFloat)collapsedTopToolbarHeight { + if (base::FeatureList::IsEnabled(web::features::kOutOfWebFullscreen) && + IsVisibleUrlNewTabPage(self.currentWebState)) { + return 0; + } // For the legacy UI, the toolbar is completely hidden when in fullscreen // mode. After the UI refresh, kToolbarHeightFullscreen is still visible // after scroll events. @@ -4121,10 +4126,18 @@ } - (CGFloat)expandedTopToolbarHeight { + if (base::FeatureList::IsEnabled(web::features::kOutOfWebFullscreen) && + IsVisibleUrlNewTabPage(self.currentWebState)) { + return 0; + } return self.headerHeight; } - (CGFloat)bottomToolbarHeight { + if (base::FeatureList::IsEnabled(web::features::kOutOfWebFullscreen) && + IsVisibleUrlNewTabPage(self.currentWebState)) { + return 0; + } return [self secondaryToolbarHeightWithInset]; } @@ -5202,6 +5215,7 @@ - (void)tabModel:(TabModel*)model didFinishLoadingTab:(Tab*)tab success:(BOOL)success { + [_toolbarUIUpdater updateState]; [self tabLoadComplete:tab withSuccess:success]; if ([self canShowTabStrip]) { UIUserInterfaceSizeClass sizeClass =
diff --git a/ios/chrome/browser/ui/fullscreen/BUILD.gn b/ios/chrome/browser/ui/fullscreen/BUILD.gn index 7d8af46a..c94fa84 100644 --- a/ios/chrome/browser/ui/fullscreen/BUILD.gn +++ b/ios/chrome/browser/ui/fullscreen/BUILD.gn
@@ -90,6 +90,7 @@ ":ui", "//base", "//components/keyed_service/ios", + "//ios/chrome/browser", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/ui:ui_util", "//ios/chrome/browser/ui/broadcaster",
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_mediator.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_mediator.mm index 26cd535b7..8bda3f4 100644 --- a/ios/chrome/browser/ui/fullscreen/fullscreen_mediator.mm +++ b/ios/chrome/browser/ui/fullscreen/fullscreen_mediator.mm
@@ -71,7 +71,7 @@ observer.FullscreenProgressUpdated(controller_, model_->progress()); } - [resizer_ updateForFullscreenProgress:model->progress()]; + [resizer_ updateForCurrentState]; } void FullscreenMediator::FullscreenModelEnabledStateChanged( @@ -114,7 +114,7 @@ observer.FullscreenProgressUpdated(controller_, model_->progress()); } - [resizer_ updateForFullscreenProgress:model_->progress()]; + [resizer_ updateForCurrentState]; } void FullscreenMediator::AnimateWithStyle(FullscreenAnimatorStyle style) { @@ -129,13 +129,16 @@ style:style]; __weak FullscreenAnimator* weakAnimator = animator_; FullscreenModel** modelPtr = &model_; + [animator_ addAnimations:^{ + // Updates the WebView frame during the animation to have it animated. + [resizer_ forceToUpdateToProgress:animator_.finalProgress]; + }]; [animator_ addCompletion:^(UIViewAnimatingPosition finalPosition) { DCHECK_EQ(finalPosition, UIViewAnimatingPositionEnd); if (!weakAnimator || !*modelPtr) return; model_->AnimationEndedWithProgress( [weakAnimator progressForAnimatingPosition:finalPosition]); - [resizer_ updateForFullscreenProgress:animator_.finalProgress]; animator_ = nil; }];
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.h b/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.h index fd6dfd7..f193447 100644 --- a/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.h +++ b/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.h
@@ -27,10 +27,14 @@ // WebState currently displayed. @property(nonatomic, assign) web::WebState* webState; -// Updates the WebView of the current webState to adjust it to the current -// fullscreen |progress|. |progress| should be between 0 and 1, 0 meaning that -// the application is in fullscreen, 1 that it is out of fullscreen. -- (void)updateForFullscreenProgress:(CGFloat)progress; +// Updates the WebState view, based on the current state of the webState and the +// model. +- (void)updateForCurrentState; + +// Force the updates of the WebView to |progress|. |progress| should be between +// 0 and 1, 0 meaning that the application is in fullscreen, 1 that it is out of +// fullscreen. +- (void)forceToUpdateToProgress:(CGFloat)progress; @end
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.mm index bae68c5d..4347d00 100644 --- a/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.mm +++ b/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.h" +#include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_model.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/web/public/features.h" @@ -19,10 +20,13 @@ // The fullscreen model, used to get the information about the state of // fullscreen. @property(nonatomic, assign) FullscreenModel* model; +// Whether the content offset should be matching the frame changes. +@property(nonatomic, assign) BOOL compensateFrameChangeByOffset; @end @implementation FullscreenWebViewResizer +@synthesize compensateFrameChangeByOffset = _compensateFrameChangeByOffset; @synthesize model = _model; @synthesize webState = _webState; @@ -34,6 +38,7 @@ self = [super init]; if (self) { _model = model; + _compensateFrameChangeByOffset = YES; } return self; } @@ -54,25 +59,58 @@ _webState = webState; - if (webState) + if (webState) { [self observeWebStateViewFrame:webState]; + self.compensateFrameChangeByOffset = NO; + [self updateForCurrentState]; + self.compensateFrameChangeByOffset = YES; + } } #pragma mark - Public +- (void)updateForCurrentState { + if (!self.webState) + return; + + [self updateForFullscreenProgress:self.model->progress()]; +} + +- (void)forceToUpdateToProgress:(CGFloat)progress { + if (!self.webState) + return; + + [self.webState->GetView() removeObserver:self forKeyPath:@"frame"]; + [self updateForFullscreenProgress:progress]; + [self observeWebStateViewFrame:self.webState]; +} + +#pragma mark - Private + +// Updates the WebView of the current webState to adjust it to the current +// fullscreen |progress|. |progress| should be between 0 and 1, 0 meaning that +// the application is in fullscreen, 1 that it is out of fullscreen. - (void)updateForFullscreenProgress:(CGFloat)progress { if (!self.webState || !self.webState->GetView().superview) return; - UIView* webView = self.webState->GetView(); - UIEdgeInsets newInsets = UIEdgeInsetsMake(self.model->GetCollapsedToolbarHeight() + progress * (self.model->GetExpandedToolbarHeight() - self.model->GetCollapsedToolbarHeight()), 0, progress * self.model->GetBottomToolbarHeight(), 0); - CGRect newFrame = UIEdgeInsetsInsetRect(webView.superview.bounds, newInsets); + [self updateForInsets:newInsets]; +} + +// Updates the WebState view, resizing it such as |insets| is the insets between +// the WebState view and its superview. +- (void)updateForInsets:(UIEdgeInsets)insets { + UIView* webView = self.webState->GetView(); + + id<CRWWebViewProxy> webViewProxy = self.webState->GetWebViewProxy(); + CRWWebViewScrollViewProxy* scrollViewProxy = webViewProxy.scrollViewProxy; + CGRect newFrame = UIEdgeInsetsInsetRect(webView.superview.bounds, insets); // Make sure the frame has changed to avoid a loop as the frame property is // actually monitored by this object. @@ -82,10 +120,26 @@ std::fabs(newFrame.size.height - webView.frame.size.height) < 0.01) return; - webView.frame = newFrame; -} + // Update the content offset of the scroll view to match the padding + // that will be included in the frame. + CGFloat currentTopInset = webView.frame.origin.y; + CGPoint newContentOffset = scrollViewProxy.contentOffset; + newContentOffset.y += insets.top - currentTopInset; + if (self.compensateFrameChangeByOffset) { + scrollViewProxy.contentOffset = newContentOffset; + } -#pragma mark - Private + webView.frame = newFrame; + + // Setting WKWebView frame can mistakenly reset contentOffset. Change it + // back to the initial value if necessary. + // TODO(crbug.com/645857): Remove this workaround once WebKit bug is + // fixed. + if (self.compensateFrameChangeByOffset && + [scrollViewProxy contentOffset].y != newContentOffset.y) { + [scrollViewProxy setContentOffset:newContentOffset]; + } +} // Observes the frame property of the view of the |webState| using KVO. - (void)observeWebStateViewFrame:(web::WebState*)webState { @@ -94,7 +148,7 @@ [webState->GetView() addObserver:self forKeyPath:@"frame" - options:NSKeyValueObservingOptionInitial + options:0 context:nil]; } @@ -106,7 +160,7 @@ if (![keyPath isEqualToString:@"frame"] || object != _webState->GetView()) return; - [self updateForFullscreenProgress:self.model->progress()]; + [self updateForCurrentState]; } @end
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer_unittest.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer_unittest.mm index b13892d..fb5ee56 100644 --- a/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer_unittest.mm +++ b/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer_unittest.mm
@@ -59,7 +59,6 @@ // Tests that updating the resizer works as expected. TEST_F(FullscreenWebViewResizerTest, UpdateWebState) { - // Test. ASSERT_EQ(1, _model.progress()); FullscreenWebViewResizer* resizer = [[FullscreenWebViewResizer alloc] initWithModel:&_model]; @@ -74,12 +73,28 @@ // Scroll the view then update the resizer. _model.SetYContentOffset(50); ASSERT_EQ(0, _model.progress()); - [resizer updateForFullscreenProgress:0]; + [resizer updateForCurrentState]; CGRect smallInsetFrame = CGRectMake(0, kTopToolbarCollapsedHeight, kViewWidth, kViewHeight - kTopToolbarCollapsedHeight); EXPECT_TRUE(CGRectEqualToRect(smallInsetFrame, _webStateView.frame)); } +// Tests that it is possible to force the update the of the Resizer to a value +// differente from the model's one. +TEST_F(FullscreenWebViewResizerTest, ForceUpdateWebState) { + FullscreenWebViewResizer* resizer = + [[FullscreenWebViewResizer alloc] initWithModel:&_model]; + resizer.webState = &_webState; + + ASSERT_EQ(1, _model.progress()); + + // The frame should be updated when setting the WebState. + CGRect smallInsetFrame = CGRectMake(0, kTopToolbarCollapsedHeight, kViewWidth, + kViewHeight - kTopToolbarCollapsedHeight); + [resizer forceToUpdateToProgress:0]; + EXPECT_TRUE(CGRectEqualToRect(smallInsetFrame, _webStateView.frame)); +} + // Tests that nothing happen if there is no superview for the web state view. TEST_F(FullscreenWebViewResizerTest, WebStateNoSuperview) { // WebState view setup. @@ -90,22 +105,20 @@ web::TestWebState webState; webState.SetView(webStateView); - // Test. FullscreenWebViewResizer* resizer = [[FullscreenWebViewResizer alloc] initWithModel:&_model]; resizer.webState = &webState; EXPECT_TRUE(CGRectEqualToRect(webViewFrame, webStateView.frame)); - [resizer updateForFullscreenProgress:1]; + [resizer updateForCurrentState]; EXPECT_TRUE(CGRectEqualToRect(webViewFrame, webStateView.frame)); } // Tests that nothing happen (no crash) if there is no web state. TEST_F(FullscreenWebViewResizerTest, NoWebState) { - // Test. FullscreenWebViewResizer* resizer = [[FullscreenWebViewResizer alloc] initWithModel:&_model]; - [resizer updateForFullscreenProgress:1]; + [resizer updateForCurrentState]; }
diff --git a/ios/chrome/browser/ui/image_util/image_copier.mm b/ios/chrome/browser/ui/image_util/image_copier.mm index bb01a563..4ce8384 100644 --- a/ios/chrome/browser/ui/image_util/image_copier.mm +++ b/ios/chrome/browser/ui/image_util/image_copier.mm
@@ -6,6 +6,7 @@ #include <MobileCoreServices/MobileCoreServices.h> +#include "base/metrics/histogram_macros.h" #import "base/strings/sys_string_conversions.h" #include "base/task/post_task.h" #include "components/strings/grit/components_strings.h" @@ -22,6 +23,27 @@ #endif namespace { +// Name of the UMA ContextMenu.iOS.CopyImage histogram. +const char kUmaContextMenuCopyImage[] = "ContextMenu.iOS.CopyImage"; +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. +// Enum for the ContextMenu.iOS.CopyImage UMA histogram to report +// the results of Copy Image. +enum class ContextMenuCopyImage { + // Copy Image is called. + kInvoked = 0, + // Image data is fetched. + kImageFetched = 1, + // Image data is fetched, and Copy Image is not canceled by user. + kTryCopyImage = 2, + // Fetched image data is valid and copied to pasteboard. + kImageCopied = 3, + // Fetching image data takes too long, a waiting alert popped up. + kAlertPopUp = 4, + // Copy Image is canceled by user from the alert. + kCanceled = 5, + kMaxValue = kCanceled, +}; // Time Period between "Copy Image" is clicked and "Copying..." alert is // launched. const int kAlertDelayInMs = 300; @@ -42,6 +64,7 @@ // CopyImageAtURL:referrer:webState is called, and before user cancels the // copy or the copy finishes. @property(nonatomic) int activeID; + @end @implementation ImageCopier @@ -65,25 +88,8 @@ - (void)copyImageAtURL:(const GURL&)url referrer:(const web::Referrer&)referrer webState:(web::WebState*)webState { - // Dismiss current alert. - [self.alertCoordinator stop]; - __weak ImageCopier* weakSelf = self; - self.alertCoordinator = [[AlertCoordinator alloc] - initWithBaseViewController:self.baseViewController - title:l10n_util::GetNSStringWithFixup( - IDS_IOS_CONTENT_COPYIMAGE_ALERT_COPYING) - message:nil]; - [self.alertCoordinator - addItemWithTitle:l10n_util::GetNSStringWithFixup(IDS_CANCEL) - action:^() { - // Cancel current copy and closes the alert. - weakSelf.activeID = kNoActiveCopy; - [weakSelf.alertCoordinator stop]; - } - style:UIAlertActionStyleCancel]; - // |idGenerator| is initiated to 1 and incremented by 2, so it will always be // odd number and won't collides with |kNoActiveCopy| or nil.activeID, which // are 0s. @@ -101,31 +107,60 @@ tabHelper->GetImageData(url, referrer, ^(NSData* data) { // Check that the copy has not been canceled. if (callbackID == weakSelf.activeID) { + [weakSelf.alertCoordinator stop]; + weakSelf.activeID = kNoActiveCopy; + + // Copy image url and data to pasteboard. NSMutableDictionary* item = [NSMutableDictionary dictionaryWithCapacity:3]; [item setValue:urlStr forKey:(__bridge NSString*)kUTTypeText]; [item setValue:[NSURL URLWithString:urlStr] forKey:(__bridge NSString*)kUTTypeURL]; NSString* uti = GetImageUTIFromData(data); - if (uti) + if (uti) { [item setValue:data forKey:uti]; + [weakSelf recordCopyImageUMA:ContextMenuCopyImage::kImageCopied]; + } UIPasteboard.generalPasteboard.items = [NSMutableArray arrayWithObject:item]; - // Finishes this copy. - weakSelf.activeID = kNoActiveCopy; - [weakSelf.alertCoordinator stop]; + [weakSelf recordCopyImageUMA:ContextMenuCopyImage::kTryCopyImage]; } + [weakSelf recordCopyImageUMA:ContextMenuCopyImage::kImageFetched]; }); - // Delay launching alert by |kAlertDelayInMs|. + // Dismiss current alert. + [self.alertCoordinator stop]; + self.alertCoordinator = [[AlertCoordinator alloc] + initWithBaseViewController:self.baseViewController + title:l10n_util::GetNSStringWithFixup( + IDS_IOS_CONTENT_COPYIMAGE_ALERT_COPYING) + message:nil]; + [self.alertCoordinator + addItemWithTitle:l10n_util::GetNSStringWithFixup(IDS_CANCEL) + action:^() { + // Cancels current copy and closes the alert. + weakSelf.activeID = kNoActiveCopy; + [weakSelf.alertCoordinator stop]; + [weakSelf recordCopyImageUMA:ContextMenuCopyImage::kCanceled]; + } + style:UIAlertActionStyleCancel]; + + // Delays launching alert by |kAlertDelayInMs|. base::PostDelayedTaskWithTraits( FROM_HERE, {web::WebThread::UI}, base::BindOnce(^{ // Checks that the copy has not finished yet. if (callbackID == weakSelf.activeID) { [weakSelf.alertCoordinator start]; + [weakSelf recordCopyImageUMA:ContextMenuCopyImage::kAlertPopUp]; } }), base::TimeDelta::FromMilliseconds(kAlertDelayInMs)); + + [self recordCopyImageUMA:ContextMenuCopyImage::kInvoked]; +} + +- (void)recordCopyImageUMA:(ContextMenuCopyImage)UMAEnum { + UMA_HISTOGRAM_ENUMERATION(kUmaContextMenuCopyImage, UMAEnum); } @end
diff --git a/ios/chrome/browser/ui/settings/cells/settings_search_item.mm b/ios/chrome/browser/ui/settings/cells/settings_search_item.mm index 24cd78e..50eb0ea2 100644 --- a/ios/chrome/browser/ui/settings/cells/settings_search_item.mm +++ b/ios/chrome/browser/ui/settings/cells/settings_search_item.mm
@@ -5,10 +5,12 @@ #import "ios/chrome/browser/ui/settings/cells/settings_search_item.h" #include "base/mac/foundation_util.h" +#include "components/strings/grit/components_strings.h" #import "ios/chrome/browser/ui/icons/chrome_icon.h" #include "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/common/ui_util/constraints_ui_util.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" +#include "ui/base/l10n/l10n_util_mac.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -28,9 +30,17 @@ const CGFloat kCornerRadius = 12.0f; // Input field disabled alpha. const CGFloat kDisabledAlpha = 0.6f; +// Cancel button animation duration. +const CGFloat kCancelButtonAnimationDuration = 0.2f; } // namespace @interface SettingsSearchCell ()<UITextFieldDelegate> +// Cancel button for dismissing the search view. +@property(nonatomic, strong) UIButton* cancelButton; +@property(nonatomic, strong) + NSArray<NSLayoutConstraint*>* cancelUnfocusedConstraint; +@property(nonatomic, strong) + NSArray<NSLayoutConstraint*>* cancelFocusedConstraint; @end @implementation SettingsSearchItem @@ -67,6 +77,9 @@ @synthesize delegate = _delegate; @synthesize textField = _textField; +@synthesize cancelButton = _cancelButton; +@synthesize cancelUnfocusedConstraint = _cancelUnfocusedConstraint; +@synthesize cancelFocusedConstraint = _cancelFocusedConstraint; - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; @@ -99,20 +112,67 @@ _textField.leftView = searchIconView; _textField.clearButtonMode = UITextFieldViewModeAlways; [_textField setRightViewMode:UITextFieldViewModeNever]; - _textField.translatesAutoresizingMaskIntoConstraints = NO; _textField.autocorrectionType = UITextAutocorrectionTypeNo; _textField.autocapitalizationType = UITextAutocapitalizationTypeNone; _textField.spellCheckingType = UITextSpellCheckingTypeNo; + _textField.returnKeyType = UIReturnKeySearch; + _textField.translatesAutoresizingMaskIntoConstraints = NO; [_textField setDelegate:self]; - [contentView addSubview:_textField]; + NSString* cancelButtonLabel = l10n_util::GetNSString(IDS_CANCEL); + _cancelButton = [UIButton buttonWithType:UIButtonTypeSystem]; + _cancelButton.contentHorizontalAlignment = + UIControlContentHorizontalAlignmentRight; + [_cancelButton setTitle:cancelButtonLabel forState:UIControlStateNormal]; + [_cancelButton addTarget:self + action:@selector(didTapCancelButton) + forControlEvents:UIControlEventTouchUpInside]; + _cancelButton.alpha = 0; + _cancelButton.translatesAutoresizingMaskIntoConstraints = NO; + _cancelButton.accessibilityElementsHidden = YES; + [contentView addSubview:_textField]; + [contentView addSubview:_cancelButton]; + + // Set text field fixed constraints for top, bottom and left side. AddSameConstraintsToSidesWithInsets( _textField, contentView, - LayoutSides::kLeading | LayoutSides::kTrailing | LayoutSides::kBottom | - LayoutSides::kTop, + LayoutSides::kLeading | LayoutSides::kBottom | LayoutSides::kTop, ChromeDirectionalEdgeInsetsMake(kVerticalMargin, kHorizontalMargin, - kVerticalMargin, kHorizontalMargin)); + kVerticalMargin, 0)); + + // Set cancel button fixed constraints for top and bottom. + AddSameConstraintsToSidesWithInsets( + _cancelButton, contentView, LayoutSides::kBottom | LayoutSides::kTop, + ChromeDirectionalEdgeInsetsMake(kVerticalMargin, 0, kVerticalMargin, + 0)); + + // And these are constraints that we will use for animating the slide in/out + // of the cancel button. We have constraints for unfocused mode, + // where text field extends to the right (minus margin) of the content view + // and cancel button is 'hidden' by being left aligned at the right of the + // content view (where we want it to start it's slide in). + _cancelUnfocusedConstraint = @[ + [_textField.trailingAnchor + constraintEqualToAnchor:contentView.trailingAnchor + constant:-kHorizontalMargin], + [_cancelButton.leadingAnchor + constraintEqualToAnchor:contentView.trailingAnchor], + ]; + // And when focused, we'll attach the text field's right side to the cancel + // button's left (minus margin) and attach the cancel button's right side to + // the content view's right (minus margin). + _cancelFocusedConstraint = @[ + [_textField.trailingAnchor + constraintEqualToAnchor:_cancelButton.leadingAnchor + constant:-kHorizontalMargin], + [_cancelButton.trailingAnchor + constraintEqualToAnchor:contentView.trailingAnchor + constant:-kHorizontalMargin], + ]; + + // We start unfocused. + [NSLayoutConstraint activateConstraints:_cancelUnfocusedConstraint]; } return self; } @@ -128,6 +188,34 @@ #pragma mark - UITextFieldDelegate +// Slides cancel button in when textfield is focused. +- (void)textFieldDidBeginEditing:(UITextField*)textField { + void (^animations)() = ^{ + self.cancelButton.accessibilityElementsHidden = NO; + self.cancelButton.alpha = 1.0f; + [NSLayoutConstraint deactivateConstraints:self.cancelUnfocusedConstraint]; + [NSLayoutConstraint activateConstraints:self.cancelFocusedConstraint]; + [self.contentView layoutIfNeeded]; + }; + + [UIView animateWithDuration:kCancelButtonAnimationDuration + animations:animations]; +} + +// Slides cancel button out when textfield is not focused. +- (void)textFieldDidEndEditing:(UITextField*)textField { + void (^animations)() = ^{ + self.cancelButton.alpha = 0.0f; + self.cancelButton.accessibilityElementsHidden = YES; + [NSLayoutConstraint deactivateConstraints:self.cancelFocusedConstraint]; + [NSLayoutConstraint activateConstraints:self.cancelUnfocusedConstraint]; + [self.contentView layoutIfNeeded]; + }; + + [UIView animateWithDuration:kCancelButtonAnimationDuration + animations:animations]; +} + - (BOOL)textField:(UITextField*)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string { @@ -147,4 +235,12 @@ return YES; } +#pragma mark - Actions + +- (void)didTapCancelButton { + self.textField.text = @""; + [self.delegate didRequestSearchForTerm:@""]; + [self.textField endEditing:YES]; +} + @end
diff --git a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm index b9445b6..0528f3c 100644 --- a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm
@@ -1051,7 +1051,21 @@ base::mac::ObjCCastStrict<SettingsSearchItem>( [model itemAtIndexPath:itemPath]); [searchItem setEnabled:enabled]; - [self reconfigureCellsForItems:@[ searchItem ]]; + + NSIndexPath* indexPath = + [self.collectionViewModel indexPathForItem:searchItem]; + MDCCollectionViewCell* cell = + base::mac::ObjCCastStrict<MDCCollectionViewCell>( + [self.collectionView cellForItemAtIndexPath:indexPath]); + + // |cell| may be nil if the row is not currently on screen. If that's the case + // and we are disabling we force the keyboard down (since the cell can't do it + // for us). + if (cell) { + [searchItem configureCell:cell]; + } else if (!enabled) { + [self.view endEditing:YES]; + } } #pragma mark - Testing
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_mediator.mm b/ios/chrome/browser/ui/tab_grid/tab_grid_mediator.mm index ae02ca5..dc58a4cf 100644 --- a/ios/chrome/browser/ui/tab_grid/tab_grid_mediator.mm +++ b/ios/chrome/browser/ui/tab_grid/tab_grid_mediator.mm
@@ -16,6 +16,7 @@ #include "ios/chrome/browser/experimental_flags.h" #import "ios/chrome/browser/snapshots/snapshot_cache.h" #import "ios/chrome/browser/snapshots/snapshot_cache_factory.h" +#import "ios/chrome/browser/snapshots/snapshot_cache_observer.h" #import "ios/chrome/browser/snapshots/snapshot_tab_helper.h" #import "ios/chrome/browser/tabs/tab_model.h" #import "ios/chrome/browser/ui/tab_grid/grid/grid_consumer.h" @@ -96,7 +97,9 @@ } // namespace -@interface TabGridMediator ()<CRWWebStateObserver, WebStateListObserving> +@interface TabGridMediator ()<CRWWebStateObserver, + SnapshotCacheObserver, + WebStateListObserving> // The list from the tab model. @property(nonatomic, assign) WebStateList* webStateList; // The UI consumer to which updates are made. @@ -152,9 +155,11 @@ #pragma mark - Public properties - (void)setTabModel:(TabModel*)tabModel { + [self.snapshotCache removeObserver:self]; _scopedWebStateListObserver->RemoveAll(); _scopedWebStateObserver->RemoveAll(); _tabModel = tabModel; + [self.snapshotCache addObserver:self]; _webStateList = tabModel.webStateList; if (_webStateList) { _scopedWebStateListObserver->Add(_webStateList); @@ -232,6 +237,23 @@ [self.consumer replaceItemID:itemID withItem:CreateItem(webState)]; } +#pragma mark - SnapshotCacheObserver + +- (void)snapshotCache:(SnapshotCache*)snapshotCache + didUpdateSnapshotForIdentifier:(NSString*)identifier { + if (!IsWKWebViewSnapshotsEnabled()) { + // This feature guard is here to compare against the existing baseline. + // Prior to enabling WKWebViewSnapshots, the mediator was not a + // SnapshotCache observer. + return; + } + [self.appearanceCache removeObjectForKey:identifier]; + web::WebState* webState = GetWebStateWithId(self.webStateList, identifier); + if (webState) { + [self.consumer replaceItemID:identifier withItem:CreateItem(webState)]; + } +} + #pragma mark - GridCommands - (void)addNewItem { @@ -432,4 +454,11 @@ } } +// Returns a SnapshotCache for the current BrowserState. +- (SnapshotCache*)snapshotCache { + if (!_tabModel.browserState) + return nil; + return SnapshotCacheFactory::GetForBrowserState(_tabModel.browserState); +} + @end
diff --git a/ios/chrome/browser/ui/ui_feature_flags.cc b/ios/chrome/browser/ui/ui_feature_flags.cc index 20bfa86..11c366d7 100644 --- a/ios/chrome/browser/ui/ui_feature_flags.cc +++ b/ios/chrome/browser/ui/ui_feature_flags.cc
@@ -9,5 +9,7 @@ const base::Feature kCopyImage{"CopyImage", base::FEATURE_ENABLED_BY_DEFAULT}; +const base::Feature kOmniboxPopupShortcuts{"OmniboxPopupShortcuts", + base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kWKWebViewSnapshots{"WKWebViewSnapshots", 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 9fe790d..2079a15 100644 --- a/ios/chrome/browser/ui/ui_feature_flags.h +++ b/ios/chrome/browser/ui/ui_feature_flags.h
@@ -15,6 +15,10 @@ // Feature to copy image to system pasteboard via context menu. extern const base::Feature kCopyImage; +// Feature to show most visited sites and collection shortcuts in the omnibox +// popup instead of ZeroSuggest. +extern const base::Feature kOmniboxPopupShortcuts; + // Used to enable using the WKWebView snapshotting API for iOS 11+. extern const base::Feature kWKWebViewSnapshots;
diff --git a/ios/net/cookies/system_cookie_store.h b/ios/net/cookies/system_cookie_store.h index 5a63abf..1753f03 100644 --- a/ios/net/cookies/system_cookie_store.h +++ b/ios/net/cookies/system_cookie_store.h
@@ -85,6 +85,7 @@ // TODO(crbug.com/825227): Move this to be private. std::unique_ptr<CookieCreationTimeManager> creation_time_manager_; + private: // Weak Ptr factory. base::WeakPtrFactory<SystemCookieStore> weak_factory_; };
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn index e4ecd823..f8715af7 100644 --- a/ios/web/BUILD.gn +++ b/ios/web/BUILD.gn
@@ -529,6 +529,7 @@ "//ios/web/test:test_constants", "//ios/web/test:test_support", "//net:test_support", + "//services/network:test_support", "//services/service_manager/public/cpp", "//testing/gmock", "//testing/gtest",
diff --git a/ios/web/navigation/wk_based_navigation_manager_impl.mm b/ios/web/navigation/wk_based_navigation_manager_impl.mm index 0b637d9f..9672644 100644 --- a/ios/web/navigation/wk_based_navigation_manager_impl.mm +++ b/ios/web/navigation/wk_based_navigation_manager_impl.mm
@@ -723,9 +723,7 @@ // components outside of //ios/web layer. if (wk_navigation_util::IsRestoreSessionUrl(url)) { GURL virtual_url; - bool success = wk_navigation_util::ExtractTargetURL(url, &virtual_url); - DCHECK(success); - if (success) { + if (wk_navigation_util::ExtractTargetURL(url, &virtual_url)) { if (wk_navigation_util::IsPlaceholderUrl(virtual_url)) { new_item->SetVirtualURL( wk_navigation_util::ExtractUrlFromPlaceholderUrl(virtual_url));
diff --git a/ios/web/net/cookies/wk_http_system_cookie_store.mm b/ios/web/net/cookies/wk_http_system_cookie_store.mm index 3547691..afcaf15f 100644 --- a/ios/web/net/cookies/wk_http_system_cookie_store.mm +++ b/ios/web/net/cookies/wk_http_system_cookie_store.mm
@@ -71,22 +71,32 @@ __block SystemCookieCallbackForCookies shared_callback = std::move(callback); base::WeakPtr<net::CookieCreationTimeManager> weak_time_manager = creation_time_manager_->GetWeakPtr(); + __weak WKHTTPCookieStore* block_cookie_store = cookie_store_; GURL block_url = url; base::PostTaskWithTraits( FROM_HERE, {web::WebThread::UI}, base::BindOnce(^{ - [cookie_store_ getAllCookies:^(NSArray<NSHTTPCookie*>* cookies) { - NSMutableArray* result = [NSMutableArray array]; - for (NSHTTPCookie* cookie in cookies) { - if (ShouldIncludeForRequestUrl(cookie, block_url)) { - [result addObject:cookie]; - } - } + WKHTTPCookieStore* strong_cookie_store = block_cookie_store; + if (strong_cookie_store) { + [strong_cookie_store + getAllCookies:^(NSArray<NSHTTPCookie*>* cookies) { + NSMutableArray* result = [NSMutableArray array]; + for (NSHTTPCookie* cookie in cookies) { + if (ShouldIncludeForRequestUrl(cookie, block_url)) { + [result addObject:cookie]; + } + } + net::ReportGetCookiesForURLResult( + net::SystemCookieStoreType::kWKHTTPSystemCookieStore, + result.count != 0); + RunSystemCookieCallbackForCookies(std::move(shared_callback), + weak_time_manager, result); + }]; + } else { net::ReportGetCookiesForURLResult( - net::SystemCookieStoreType::kWKHTTPSystemCookieStore, - cookies.count != 0); + net::SystemCookieStoreType::kWKHTTPSystemCookieStore, false); RunSystemCookieCallbackForCookies(std::move(shared_callback), - weak_time_manager, result); - }]; + weak_time_manager, @[]); + } })); } @@ -95,14 +105,22 @@ // This function shouldn't be called if cookie_store_ is deleted. DCHECK(cookie_store_); __block SystemCookieCallbackForCookies shared_callback = std::move(callback); + __weak WKHTTPCookieStore* block_cookie_store = cookie_store_; base::WeakPtr<net::CookieCreationTimeManager> weak_time_manager = creation_time_manager_->GetWeakPtr(); base::PostTaskWithTraits( FROM_HERE, {web::WebThread::UI}, base::BindOnce(^{ - [cookie_store_ getAllCookies:^(NSArray<NSHTTPCookie*>* cookies) { + WKHTTPCookieStore* strong_cookie_store = block_cookie_store; + if (strong_cookie_store) { + [strong_cookie_store + getAllCookies:^(NSArray<NSHTTPCookie*>* cookies) { + RunSystemCookieCallbackForCookies(std::move(shared_callback), + weak_time_manager, cookies); + }]; + } else { RunSystemCookieCallbackForCookies(std::move(shared_callback), - weak_time_manager, cookies); - }]; + weak_time_manager, @[]); + } })); } @@ -114,19 +132,22 @@ base::WeakPtr<net::CookieCreationTimeManager> weak_time_manager = creation_time_manager_->GetWeakPtr(); NSHTTPCookie* block_cookie = cookie; + __weak WKHTTPCookieStore* block_cookie_store = cookie_store_; base::PostTaskWithTraits( FROM_HERE, {web::WebThread::UI}, base::BindOnce(^{ - [cookie_store_ deleteCookie:block_cookie - completionHandler:^{ - RunBlockOnIOThread(^{ - if (weak_time_manager) - weak_time_manager->DeleteCreationTime(block_cookie); - if (!shared_callback.is_null()) - std::move(shared_callback).Run(); - }); - }]; + [block_cookie_store + deleteCookie:block_cookie + completionHandler:^{ + RunBlockOnIOThread(^{ + if (weak_time_manager) + weak_time_manager->DeleteCreationTime(block_cookie); + if (!shared_callback.is_null()) + std::move(shared_callback).Run(); + }); + }]; })); } + void WKHTTPSystemCookieStore::SetCookieAsync( NSHTTPCookie* cookie, const base::Time* optional_creation_time, @@ -140,10 +161,10 @@ base::Time cookie_time = base::Time::Now(); if (optional_creation_time && !optional_creation_time->is_null()) cookie_time = *optional_creation_time; - + __weak WKHTTPCookieStore* block_cookie_store = cookie_store_; base::PostTaskWithTraits( FROM_HERE, {web::WebThread::UI}, base::BindOnce(^{ - [cookie_store_ + [block_cookie_store setCookie:block_cookie completionHandler:^{ RunBlockOnIOThread(^{ @@ -163,9 +184,10 @@ __block SystemCookieCallback shared_callback = std::move(callback); base::WeakPtr<net::CookieCreationTimeManager> weak_time_manager = creation_time_manager_->GetWeakPtr(); + __weak WKHTTPCookieStore* block_cookie_store = cookie_store_; base::PostTaskWithTraits( FROM_HERE, {web::WebThread::UI}, base::BindOnce(^{ - [cookie_store_ getAllCookies:^(NSArray<NSHTTPCookie*>* cookies) { + [block_cookie_store getAllCookies:^(NSArray<NSHTTPCookie*>* cookies) { ProceduralBlock completionHandler = ^{ RunBlockOnIOThread(^{ if (weak_time_manager) @@ -185,13 +207,13 @@ } for (NSHTTPCookie* cookie in cookies) { - [cookie_store_ deleteCookie:cookie - completionHandler:^{ - DCHECK(remainingCookiesToClearCount); - if (--remainingCookiesToClearCount == 0) { - completionHandler(); - } - }]; + [block_cookie_store deleteCookie:cookie + completionHandler:^{ + DCHECK(remainingCookiesToClearCount); + if (--remainingCookiesToClearCount == 0) { + completionHandler(); + } + }]; } }]; })); @@ -203,13 +225,15 @@ return [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy]; } -// private static +#pragma mark private methods + +// static // Runs |callback| on |cookies| after sorting them as per RFC6265 using // |weak_time_manager|. void WKHTTPSystemCookieStore::RunSystemCookieCallbackForCookies( net::SystemCookieStore::SystemCookieCallbackForCookies callback, base::WeakPtr<net::CookieCreationTimeManager> weak_time_manager, - NSArray<NSHTTPCookie*>* cookies) { + NSArray<NSHTTPCookie*>* _Nonnull cookies) { if (callback.is_null()) return; NSArray* block_cookies = cookies;
diff --git a/ios/web/public/test/fakes/test_web_state.h b/ios/web/public/test/fakes/test_web_state.h index 4a0a335..ec7aabd 100644 --- a/ios/web/public/test/fakes/test_web_state.h +++ b/ios/web/public/test/fakes/test_web_state.h
@@ -86,8 +86,7 @@ void DidChangeVisibleSecurityState() override {} bool HasOpener() const override; void SetHasOpener(bool has_opener) override; - void TakeSnapshot(SnapshotCallback callback, - CGSize target_size) const override; + void TakeSnapshot(SnapshotCallback callback) override; // Setters for test data. void SetBrowserState(BrowserState* browser_state);
diff --git a/ios/web/public/test/fakes/test_web_state.mm b/ios/web/public/test/fakes/test_web_state.mm index 9a38a14..3367b0a 100644 --- a/ios/web/public/test/fakes/test_web_state.mm +++ b/ios/web/public/test/fakes/test_web_state.mm
@@ -389,8 +389,7 @@ has_opener_ = has_opener; } -void TestWebState::TakeSnapshot(SnapshotCallback callback, - CGSize target_size) const { +void TestWebState::TakeSnapshot(SnapshotCallback callback) { std::move(callback).Run(gfx::Image([[UIImage alloc] init])); }
diff --git a/ios/web/public/web_state/web_state.h b/ios/web/public/web_state/web_state.h index be259f0..9316ed1 100644 --- a/ios/web/public/web_state/web_state.h +++ b/ios/web/public/web_state/web_state.h
@@ -311,10 +311,10 @@ // Callback used to handle snapshots. The parameter is the snapshot image. typedef base::OnceCallback<void(gfx::Image)> SnapshotCallback; - // Takes a snapshot of this WebState with |target_size|. |callback| is - // asynchronously invoked after performing the snapshot. - virtual void TakeSnapshot(SnapshotCallback callback, - CGSize target_size) const = 0; + // Takes a snapshot of this WebState. |callback| is + // asynchronously invoked after performing the snapshot. Prior to iOS 11, the + // callback is invoked with a nil snapshot. + virtual void TakeSnapshot(SnapshotCallback callback) = 0; // Adds and removes observers for page navigation notifications. The order in // which notifications are sent to observers is undefined. Clients must be
diff --git a/ios/web/web_state/js/resources/main_frame_context_menu.js b/ios/web/web_state/js/resources/main_frame_context_menu.js index cebe954..b9171e3 100644 --- a/ios/web/web_state/js/resources/main_frame_context_menu.js +++ b/ios/web/web_state/js/resources/main_frame_context_menu.js
@@ -37,19 +37,6 @@ }; /** - * Suppresses the next click such that they are not handled by JS click - * event handlers. - * @type {void} - */ -__gCrWeb['suppressNextClick'] = function() { - var suppressNextClick = function(evt) { - evt.preventDefault(); - document.removeEventListener('click', suppressNextClick, false); - }; - document.addEventListener('click', suppressNextClick); -}; - -/** * Returns the margin in points around touchable elements (e.g. links for * custom context menu). * @type {number}
diff --git a/ios/web/web_state/ui/crw_context_menu_controller.mm b/ios/web/web_state/ui/crw_context_menu_controller.mm index 33a89015..b87e9c7 100644 --- a/ios/web/web_state/ui/crw_context_menu_controller.mm +++ b/ios/web/web_state/ui/crw_context_menu_controller.mm
@@ -365,12 +365,6 @@ CancelTouches(recognizer); } } - - // Just disabling/enabling the gesture recognizers is not enough to suppress - // the click handlers on the JS side. This JS performs the function of - // suppressing these handlers on the JS side. - NSString* suppressNextClick = @"__gCrWeb.suppressNextClick()"; - [self executeJavaScript:suppressNextClick completionHandler:nil]; } - (void)setDOMElementForLastTouch:(NSDictionary*)element {
diff --git a/ios/web/web_state/ui/crw_web_controller.h b/ios/web/web_state/ui/crw_web_controller.h index db42b57..3c2fae5 100644 --- a/ios/web/web_state/ui/crw_web_controller.h +++ b/ios/web/web_state/ui/crw_web_controller.h
@@ -211,6 +211,11 @@ (web::NavigationInitiationType)type hasUserGesture:(BOOL)hasUserGesture; +// Takes snapshot of web view. |completion| is always called, +// but |snapshot| may be nil. Prior to iOS 11, |completion| is called with a nil +// snapshot. +- (void)takeSnapshotWithCompletion:(void (^)(UIImage* snapshot))completion; + @end #pragma mark Testing
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 86f6c39..bd17fe7d 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -2282,6 +2282,25 @@ self.navigationManagerImpl->DiscardNonCommittedItems(); } +- (void)takeSnapshotWithCompletion:(void (^)(UIImage*))completion { + if (@available(iOS 11, *)) { + if (_webView) { + [_webView + takeSnapshotWithConfiguration:nil + completionHandler:^(UIImage* snapshot, NSError* error) { + if (error) + DLOG(ERROR) << "WKWebView snapshot error: " + << error.description; + completion(snapshot); + }]; + return; + } + } + dispatch_async(dispatch_get_main_queue(), ^{ + completion(nil); + }); +} + #pragma mark - #pragma mark CRWWebControllerContainerViewDelegate
diff --git a/ios/web/web_state/ui/crw_web_view_content_view.mm b/ios/web/web_state/ui/crw_web_view_content_view.mm index d8a0808..d9a9cb4 100644 --- a/ios/web/web_state/ui/crw_web_view_content_view.mm +++ b/ios/web/web_state/ui/crw_web_view_content_view.mm
@@ -136,6 +136,9 @@ // Updates the viewport by updating the web view frame after self.contentInset // is changed to a new value from |oldInsets|. - (void)resizeViewportForContentInsetChangeFromInsets:(UIEdgeInsets)oldInsets { + if (base::FeatureList::IsEnabled(web::features::kOutOfWebFullscreen)) + return; + // Update the content offset of the scroll view to match the padding // that will be included in the frame. CGFloat topPaddingChange = self.contentInset.top - oldInsets.top;
diff --git a/ios/web/web_state/web_state_impl.h b/ios/web/web_state/web_state_impl.h index 754f24ec..2f5247d 100644 --- a/ios/web/web_state/web_state_impl.h +++ b/ios/web/web_state/web_state_impl.h
@@ -234,8 +234,7 @@ mojo::ScopedMessagePipeHandle interface_pipe) override; bool HasOpener() const override; void SetHasOpener(bool has_opener) override; - void TakeSnapshot(SnapshotCallback callback, - CGSize target_size) const override; + void TakeSnapshot(SnapshotCallback callback) override; void AddObserver(WebStateObserver* observer) override; void RemoveObserver(WebStateObserver* observer) override;
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm index 62eba67..54f7e96 100644 --- a/ios/web/web_state/web_state_impl.mm +++ b/ios/web/web_state/web_state_impl.mm
@@ -727,21 +727,11 @@ created_with_opener_ = has_opener; } -void WebStateImpl::TakeSnapshot(SnapshotCallback callback, - CGSize target_size) const { - UIView* view = [web_controller_ view]; - UIImage* snapshot = nil; - if (view && !CGRectIsEmpty(view.bounds)) { - CGFloat scaled_height = - view.bounds.size.height * target_size.width / view.bounds.size.width; - CGRect scaled_rect = CGRectMake(0, 0, target_size.width, scaled_height); - UIGraphicsBeginImageContextWithOptions(target_size, YES, 0); - [view drawViewHierarchyInRect:scaled_rect afterScreenUpdates:NO]; - snapshot = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - } - base::SequencedTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), gfx::Image(snapshot))); +void WebStateImpl::TakeSnapshot(SnapshotCallback callback) { + __block SnapshotCallback shared_callback = std::move(callback); + [web_controller_ takeSnapshotWithCompletion:^(UIImage* snapshot) { + std::move(shared_callback).Run(gfx::Image(snapshot)); + }]; } void WebStateImpl::OnNavigationStarted(web::NavigationContext* context) {
diff --git a/ios/web/web_state/web_state_observer_inttest.mm b/ios/web/web_state/web_state_observer_inttest.mm index a7d4a6e..d7bf6af6 100644 --- a/ios/web/web_state/web_state_observer_inttest.mm +++ b/ios/web/web_state/web_state_observer_inttest.mm
@@ -11,6 +11,8 @@ #import "base/test/ios/wait_util.h" #include "base/test/scoped_feature_list.h" #include "ios/testing/embedded_test_server_handlers.h" +#import "ios/web/public/crw_navigation_item_storage.h" +#import "ios/web/public/crw_session_storage.h" #include "ios/web/public/features.h" #import "ios/web/public/navigation_item.h" #import "ios/web/public/navigation_manager.h" @@ -1784,6 +1786,39 @@ EXPECT_FALSE(web_state()->GetNavigationManager()->CanGoForward()); } +// Verifies that WebState::CreateWithStorageSession does not call any +// WebStateObserver callbacks. +TEST_P(WebStateObserverTest, RestoreSession) { + // Create session storage. + CRWNavigationItemStorage* item = [[CRWNavigationItemStorage alloc] init]; + item.virtualURL = GURL("http://www.test.com"); + NSArray<CRWNavigationItemStorage*>* item_storages = @[ item ]; + + // Create the session with storage and add observer. + WebState::CreateParams params(GetBrowserState()); + CRWSessionStorage* session_storage = [[CRWSessionStorage alloc] init]; + session_storage.itemStorages = item_storages; + auto web_state = WebState::CreateWithStorageSession(params, session_storage); + StrictMock<WebStateObserverMock> observer; + ScopedObserver<WebState, WebStateObserver> scoped_observer(&observer); + scoped_observer.Add(web_state.get()); + + // TODO(crbug.com/877671): No WebStateObserver callbacks should be called. + EXPECT_CALL(observer, DidStartLoading(web_state.get())); + + // Trigger the session restoration. + NavigationManager* navigation_manager = web_state->GetNavigationManager(); + // TODO(crbug.com/873729): The session will not be restored until + // LoadIfNecessary call. Fix the bug and replace this call with + // SessionStorageBuilder::ExtractSessionState(). + navigation_manager->LoadIfNecessary(); + + // Wait until the session is restored. + EXPECT_TRUE(WaitUntilConditionOrTimeout(kWaitForPageLoadTimeout, ^{ + return navigation_manager->GetItemCount() == 1; + })); +} + INSTANTIATE_TEST_CASE_P( ProgrammaticWebStateObserverTest, WebStateObserverTest,
diff --git a/ios/web/web_state/web_state_unittest.mm b/ios/web/web_state/web_state_unittest.mm index cb2c2bf..3b9aaa1 100644 --- a/ios/web/web_state/web_state_unittest.mm +++ b/ios/web/web_state/web_state_unittest.mm
@@ -210,23 +210,26 @@ // The subview is added but not immediately painted, so a small delay is // necessary. base::test::ios::SpinRunLoopWithMinDelay(base::TimeDelta::FromSecondsD(0.2)); - CGSize target_size = CGSizeMake(100.0f, 100.0f); - web_state()->TakeSnapshot( - base::BindOnce(^(gfx::Image snapshot) { - ASSERT_FALSE(snapshot.IsEmpty()); - EXPECT_EQ(snapshot.Width(), target_size.width); - EXPECT_EQ(snapshot.Height(), target_size.height); - // Test a pixel on the left (red) side. - gfx::test::CheckColors(gfx::test::GetPlatformImageColor( - gfx::test::ToPlatformType(snapshot), 45, 50), - SK_ColorRED); - // Test a pixel on the right (white) side. - gfx::test::CheckColors(gfx::test::GetPlatformImageColor( - gfx::test::ToPlatformType(snapshot), 55, 50), - SK_ColorWHITE); - snapshot_complete = true; - }), - target_size); + web_state()->TakeSnapshot(base::BindOnce(^(gfx::Image snapshot) { + if (@available(iOS 11, *)) { + ASSERT_FALSE(snapshot.IsEmpty()); + EXPECT_GT(snapshot.Width(), 0); + EXPECT_GT(snapshot.Height(), 0); + int red_pixel_x = (snapshot.Width() / 2) - 10; + int white_pixel_x = (snapshot.Width() / 2) + 10; + // Test a pixel on the left (red) side. + gfx::test::CheckColors( + gfx::test::GetPlatformImageColor(gfx::test::ToPlatformType(snapshot), + red_pixel_x, 50), + SK_ColorRED); + // Test a pixel on the right (white) side. + gfx::test::CheckColors( + gfx::test::GetPlatformImageColor(gfx::test::ToPlatformType(snapshot), + white_pixel_x, 50), + SK_ColorWHITE); + } + snapshot_complete = true; + })); WaitForCondition(^{ return snapshot_complete; });
diff --git a/ios/web/webui/crw_web_ui_manager.mm b/ios/web/webui/crw_web_ui_manager.mm index 4f99394..5a51b42 100644 --- a/ios/web/webui/crw_web_ui_manager.mm +++ b/ios/web/webui/crw_web_ui_manager.mm
@@ -23,6 +23,7 @@ #import "ios/web/webui/crw_web_ui_page_builder.h" #import "ios/web/webui/url_fetcher_block_adapter.h" #import "net/base/mac/url_conversions.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -204,7 +205,7 @@ fetcherForURL:(const GURL&)URL completionHandler:(web::URLFetcherBlockAdapterCompletion)handler { return std::make_unique<web::URLFetcherBlockAdapter>( - URL, _webState->GetBrowserState()->GetRequestContext(), handler); + URL, _webState->GetBrowserState()->GetSharedURLLoaderFactory(), handler); } @end
diff --git a/ios/web/webui/crw_web_ui_manager_unittest.mm b/ios/web/webui/crw_web_ui_manager_unittest.mm index ff43ecae..82ca2b28 100644 --- a/ios/web/webui/crw_web_ui_manager_unittest.mm +++ b/ios/web/webui/crw_web_ui_manager_unittest.mm
@@ -63,9 +63,9 @@ public: MockURLFetcherBlockAdapter( const GURL& url, - net::URLRequestContextGetter* request_context, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, URLFetcherBlockAdapterCompletion completion_handler) - : URLFetcherBlockAdapter(url, request_context, completion_handler), + : URLFetcherBlockAdapter(url, url_loader_factory, completion_handler), url_(url), completion_handler_([completion_handler copy]) {}
diff --git a/ios/web/webui/url_fetcher_block_adapter.h b/ios/web/webui/url_fetcher_block_adapter.h index b55381e..17530c4 100644 --- a/ios/web/webui/url_fetcher_block_adapter.h +++ b/ios/web/webui/url_fetcher_block_adapter.h
@@ -10,50 +10,49 @@ #include <memory> #include "base/mac/scoped_block.h" -#include "net/url_request/url_fetcher_delegate.h" +#include "base/memory/scoped_refptr.h" #include "url/gurl.h" -namespace net { -class URLFetcher; -class URLRequestContextGetter; -} // namespace net +namespace network { +class SharedURLLoaderFactory; +class SimpleURLLoader; +}; // namespace network namespace web { -// Class for use of URLFetcher from Objective-C with a completion handler block. +// Class for use of URLLoader from Objective-C with a completion handler block. class URLFetcherBlockAdapter; // Block type for URLFetcherBlockAdapter callbacks. typedef void (^URLFetcherBlockAdapterCompletion)(NSData*, URLFetcherBlockAdapter*); // Class to manage retrieval of WebUI resources. -class URLFetcherBlockAdapter : public net::URLFetcherDelegate { +class URLFetcherBlockAdapter { public: // Creates URLFetcherBlockAdapter for resource at |url| with // |request_context|. // |completion_handler| is called with results of the fetch. URLFetcherBlockAdapter( const GURL& url, - net::URLRequestContextGetter* request_context, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, web::URLFetcherBlockAdapterCompletion completion_handler); - ~URLFetcherBlockAdapter() override; + virtual ~URLFetcherBlockAdapter(); // Starts the fetch. virtual void Start(); protected: - // net::URLFetcherDelegate implementation. - void OnURLFetchComplete(const net::URLFetcher* source) override; + void OnURLLoadComplete(std::unique_ptr<std::string> response_body); private: // The URL to fetch. const GURL url_; - // The request context. - net::URLRequestContextGetter* request_context_; + // The URL loader factory. + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; // Callback for resource load. base::mac::ScopedBlock<web::URLFetcherBlockAdapterCompletion> completion_handler_; - // URLFetcher for retrieving data from net stack. - std::unique_ptr<net::URLFetcher> fetcher_; + // URLLoader for retrieving data from net stack. + std::unique_ptr<network::SimpleURLLoader> url_loader_; }; } // namespace web
diff --git a/ios/web/webui/url_fetcher_block_adapter.mm b/ios/web/webui/url_fetcher_block_adapter.mm index 596b39db..87fd05b 100644 --- a/ios/web/webui/url_fetcher_block_adapter.mm +++ b/ios/web/webui/url_fetcher_block_adapter.mm
@@ -5,8 +5,8 @@ #import "ios/web/webui/url_fetcher_block_adapter.h" #include "base/logging.h" -#include "net/url_request/url_fetcher.h" -#include "net/url_request/url_request_context_getter.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/cpp/simple_url_loader.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -16,27 +16,39 @@ URLFetcherBlockAdapter::URLFetcherBlockAdapter( const GURL& url, - net::URLRequestContextGetter* request_context, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, web::URLFetcherBlockAdapterCompletion completion_handler) : url_(url), - request_context_(request_context), - completion_handler_([completion_handler copy]) { -} + url_loader_factory_(std::move(url_loader_factory)), + completion_handler_([completion_handler copy]) {} URLFetcherBlockAdapter::~URLFetcherBlockAdapter() { } void URLFetcherBlockAdapter::Start() { - fetcher_ = net::URLFetcher::Create(url_, net::URLFetcher::GET, this); - fetcher_->SetRequestContext(request_context_); - fetcher_->Start(); + auto resource_request = std::make_unique<network::ResourceRequest>(); + resource_request->url = url_; + + url_loader_ = network::SimpleURLLoader::Create(std::move(resource_request), + NO_TRAFFIC_ANNOTATION_YET); + url_loader_->DownloadToStringOfUnboundedSizeUntilCrashAndDie( + url_loader_factory_.get(), + base::BindOnce(&URLFetcherBlockAdapter::OnURLLoadComplete, + base::Unretained(this))); } -void URLFetcherBlockAdapter::OnURLFetchComplete(const net::URLFetcher* source) { +void URLFetcherBlockAdapter::OnURLLoadComplete( + std::unique_ptr<std::string> response_body) { std::string response; - if (!source->GetResponseAsString(&response)) { - DLOG(WARNING) << "String for resource URL not found" << source->GetURL(); + if (!response_body) { + DLOG(WARNING) << "String for resource URL not found" + << url_loader_->GetFinalURL(); + } else { + response = *response_body; } + + url_loader_.reset(); + NSData* data = [NSData dataWithBytes:response.c_str() length:response.length()]; completion_handler_.get()(data, this);
diff --git a/ios/web/webui/url_fetcher_block_adapter_unittest.mm b/ios/web/webui/url_fetcher_block_adapter_unittest.mm index ab44eafc..64d77a3 100644 --- a/ios/web/webui/url_fetcher_block_adapter_unittest.mm +++ b/ios/web/webui/url_fetcher_block_adapter_unittest.mm
@@ -8,12 +8,12 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" +#include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/sys_string_conversions.h" #include "base/test/scoped_task_environment.h" -#include "net/url_request/test_url_fetcher_factory.h" -#include "net/url_request/url_request_status.h" -#include "net/url_request/url_request_test_util.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/test/test_url_loader_factory.h" #import "testing/gtest_mac.h" #include "testing/platform_test.h" #include "url/gurl.h" @@ -46,11 +46,16 @@ ^(NSData* data, web::URLFetcherBlockAdapter* fetcher) { EXPECT_NSEQ(expected_data, data); }; - web::URLFetcherBlockAdapter web_ui_fetcher(test_url, nil, completion_handler); - net::FakeURLFetcher fake_fetcher(test_url, &web_ui_fetcher, response, - net::HTTP_OK, - net::URLRequestStatus::SUCCESS); - fake_fetcher.Start(); + + network::TestURLLoaderFactory test_url_loader_factory; + auto test_shared_url_loader_factory = + base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( + &test_url_loader_factory); + + web::URLFetcherBlockAdapter web_ui_fetcher( + test_url, test_shared_url_loader_factory, completion_handler); + web_ui_fetcher.Start(); + test_url_loader_factory.AddResponse(test_url.spec(), response); base::RunLoop().RunUntilIdle(); } @@ -67,13 +72,18 @@ ^(NSData* data, URLFetcherBlockAdapter* fetcher) { EXPECT_NSEQ(expected_data, data); }; - web::URLFetcherBlockAdapter web_ui_fetcher(test_url, nil, completion_handler); + + network::TestURLLoaderFactory test_url_loader_factory; + auto test_shared_url_loader_factory = + base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( + &test_url_loader_factory); + + web::URLFetcherBlockAdapter web_ui_fetcher( + test_url, test_shared_url_loader_factory, completion_handler); std::string response; EXPECT_TRUE(ReadFileToString(favicon_path, &response)); - net::FakeURLFetcher fake_fetcher(test_url, &web_ui_fetcher, response, - net::HTTP_OK, - net::URLRequestStatus::SUCCESS); - fake_fetcher.Start(); + web_ui_fetcher.Start(); + test_url_loader_factory.AddResponse(test_url.spec(), response); base::RunLoop().RunUntilIdle(); }
diff --git a/media/blink/run_all_unittests.cc b/media/blink/run_all_unittests.cc index f5ca16b..2ac885c 100644 --- a/media/blink/run_all_unittests.cc +++ b/media/blink/run_all_unittests.cc
@@ -40,22 +40,19 @@ public: BlinkPlatformWithTaskEnvironment() : main_thread_scheduler_( - blink::scheduler::CreateWebMainThreadSchedulerForTests()), - main_thread_(main_thread_scheduler_->CreateMainThread()) {} + blink::scheduler::CreateWebMainThreadSchedulerForTests()) {} ~BlinkPlatformWithTaskEnvironment() override { main_thread_scheduler_->Shutdown(); } - blink::WebThread* CurrentThread() override { - CHECK(main_thread_->IsCurrentThread()); - return main_thread_.get(); + blink::scheduler::WebThreadScheduler* GetMainThreadScheduler() { + return main_thread_scheduler_.get(); } private: base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<blink::scheduler::WebThreadScheduler> main_thread_scheduler_; - std::unique_ptr<blink::WebThread> main_thread_; DISALLOW_COPY_AND_ASSIGN(BlinkPlatformWithTaskEnvironment); }; @@ -82,7 +79,8 @@ BlinkPlatformWithTaskEnvironment platform_; service_manager::BinderRegistry empty_registry; - blink::Initialize(&platform_, &empty_registry, platform_.CurrentThread()); + blink::Initialize(&platform_, &empty_registry, + platform_.GetMainThreadScheduler()); return test_suite->Run(); }
diff --git a/media/capture/video/android/BUILD.gn b/media/capture/video/android/BUILD.gn index 808644a4..046b646 100644 --- a/media/capture/video/android/BUILD.gn +++ b/media/capture/video/android/BUILD.gn
@@ -24,6 +24,7 @@ ":capture_jni_headers", "//media/capture:capture_device_specific", "//media/capture/mojom:image_capture", + "//media/capture/mojom:image_capture_types", "//third_party/libyuv", "//ui/gfx:color_space", "//ui/gfx/geometry",
diff --git a/media/capture/video/android/video_capture_device_android.cc b/media/capture/video/android/video_capture_device_android.cc index d3751dc7..b8b0956 100644 --- a/media/capture/video/android/video_capture_device_android.cc +++ b/media/capture/video/android/video_capture_device_android.cc
@@ -14,6 +14,7 @@ #include "base/strings/string_number_conversions.h" #include "base/threading/thread_task_runner_handle.h" #include "jni/VideoCapture_jni.h" +#include "media/capture/mojom/image_capture_types.h" #include "media/capture/video/android/photo_capabilities.h" #include "media/capture/video/android/video_capture_device_factory_android.h" #include "third_party/libyuv/include/libyuv.h" @@ -396,7 +397,7 @@ // TODO(mcasas): Manual member copying sucks, consider adding typemapping from // PhotoCapabilities to mojom::PhotoStatePtr, https://crbug.com/622002. - mojom::PhotoStatePtr photo_capabilities = mojom::PhotoState::New(); + mojom::PhotoStatePtr photo_capabilities = mojo::CreateEmptyPhotoState(); const auto jni_white_balance_modes = caps.getWhiteBalanceModes(); std::vector<mojom::MeteringMode> white_balance_modes;
diff --git a/media/capture/video/chromeos/display_rotation_observer.cc b/media/capture/video/chromeos/display_rotation_observer.cc index 05445962..acabaf2 100644 --- a/media/capture/video/chromeos/display_rotation_observer.cc +++ b/media/capture/video/chromeos/display_rotation_observer.cc
@@ -44,12 +44,6 @@ DCHECK(!observer_); } -void ScreenObserverDelegate::OnDisplayAdded( - const display::Display& /*new_display*/) {} - -void ScreenObserverDelegate::OnDisplayRemoved( - const display::Display& /*old_display*/) {} - void ScreenObserverDelegate::OnDisplayMetricsChanged( const display::Display& display, uint32_t metrics) {
diff --git a/media/capture/video/chromeos/display_rotation_observer.h b/media/capture/video/chromeos/display_rotation_observer.h index 4faae2c..01d0e98 100644 --- a/media/capture/video/chromeos/display_rotation_observer.h +++ b/media/capture/video/chromeos/display_rotation_observer.h
@@ -42,8 +42,6 @@ ~ScreenObserverDelegate() override; // DisplayObserver implementations. - void OnDisplayAdded(const display::Display& /*new_display*/) override; - void OnDisplayRemoved(const display::Display& /*old_display*/) override; void OnDisplayMetricsChanged(const display::Display& display, uint32_t metrics) override;
diff --git a/media/capture/video/fake_video_capture_device.cc b/media/capture/video/fake_video_capture_device.cc index 135bbfd..e36e322 100644 --- a/media/capture/video/fake_video_capture_device.cc +++ b/media/capture/video/fake_video_capture_device.cc
@@ -19,6 +19,7 @@ #include "base/time/time.h" #include "media/audio/fake_audio_input_stream.h" #include "media/base/video_frame.h" +#include "media/capture/mojom/image_capture_types.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkMatrix.h" @@ -453,7 +454,7 @@ if (config_.should_fail_get_photo_capabilities) return; - mojom::PhotoStatePtr photo_state = mojom::PhotoState::New(); + mojom::PhotoStatePtr photo_state = mojo::CreateEmptyPhotoState(); photo_state->current_white_balance_mode = mojom::MeteringMode::NONE; photo_state->current_exposure_mode = mojom::MeteringMode::NONE;
diff --git a/media/capture/video/linux/v4l2_capture_delegate.cc b/media/capture/video/linux/v4l2_capture_delegate.cc index ecf61d7a..84033427 100644 --- a/media/capture/video/linux/v4l2_capture_delegate.cc +++ b/media/capture/video/linux/v4l2_capture_delegate.cc
@@ -18,6 +18,7 @@ #include "build/build_config.h" #include "media/base/bind_to_current_loop.h" #include "media/base/video_types.h" +#include "media/capture/mojom/image_capture_types.h" #include "media/capture/video/blob_utils.h" #include "media/capture/video/linux/video_capture_device_linux.h" @@ -420,7 +421,7 @@ if (!device_fd_.is_valid() || !is_capturing_) return; - mojom::PhotoStatePtr photo_capabilities = mojom::PhotoState::New(); + mojom::PhotoStatePtr photo_capabilities = mojo::CreateEmptyPhotoState(); photo_capabilities->zoom = RetrieveUserControlRange(V4L2_CID_ZOOM_ABSOLUTE);
diff --git a/media/renderers/audio_renderer_impl.cc b/media/renderers/audio_renderer_impl.cc index 58d512e..b2d52ea0 100644 --- a/media/renderers/audio_renderer_impl.cc +++ b/media/renderers/audio_renderer_impl.cc
@@ -829,6 +829,11 @@ return; pending_read_ = true; + + // Don't hold the lock while calling Read(), if the demuxer is busy this will + // block audio rendering for an extended period of time. + // |audio_buffer_stream_| is only accessed on |task_runner_| so this is safe. + base::AutoUnlock auto_unlock(lock_); audio_buffer_stream_->Read(base::BindOnce( &AudioRendererImpl::DecodedAudioReady, weak_factory_.GetWeakPtr())); }
diff --git a/net/BUILD.gn b/net/BUILD.gn index c798c87..4f76698 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -1385,6 +1385,13 @@ "third_party/quic/core/http/spdy_utils.cc", "third_party/quic/core/http/spdy_utils.h", "third_party/quic/core/packet_number_indexed_queue.h", + "third_party/quic/core/qpack/qpack_constants.h", + "third_party/quic/core/qpack/qpack_decoder.cc", + "third_party/quic/core/qpack/qpack_decoder.h", + "third_party/quic/core/qpack/qpack_encoder.cc", + "third_party/quic/core/qpack/qpack_encoder.h", + "third_party/quic/core/qpack/qpack_header_table.cc", + "third_party/quic/core/qpack/qpack_header_table.h", "third_party/quic/core/quic_ack_listener_interface.cc", "third_party/quic/core/quic_ack_listener_interface.h", "third_party/quic/core/quic_alarm.cc", @@ -5002,6 +5009,8 @@ "third_party/quic/core/http/quic_header_list_test.cc", "third_party/quic/core/http/quic_headers_stream_test.cc", "third_party/quic/core/packet_number_indexed_queue_test.cc", + "third_party/quic/core/qpack/qpack_decoder_test.cc", + "third_party/quic/core/qpack/qpack_encoder_test.cc", "third_party/quic/core/quic_alarm_test.cc", "third_party/quic/core/quic_arena_scoped_ptr_test.cc", "third_party/quic/core/quic_bandwidth_test.cc", @@ -5091,6 +5100,10 @@ "third_party/quic/core/http/quic_spdy_session_test.cc", "third_party/quic/core/http/quic_spdy_stream_test.cc", "third_party/quic/core/http/spdy_utils_test.cc", + "third_party/quic/core/qpack/qpack_header_table_test.cc", + "third_party/quic/core/qpack/qpack_round_trip_test.cc", + "third_party/quic/core/qpack/qpack_test_utils.cc", + "third_party/quic/core/qpack/qpack_test_utils.h", "third_party/quic/core/quic_dispatcher_test.cc", "third_party/quic/core/quic_lru_cache_test.cc", "third_party/quic/core/quic_one_block_arena_test.cc",
diff --git a/net/quic/quic_flags_list.h b/net/quic/quic_flags_list.h index 31426270..789a4701 100644 --- a/net/quic/quic_flags_list.h +++ b/net/quic/quic_flags_list.h
@@ -233,4 +233,11 @@ false) // If true, enable version 45. -QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_version_45, false) \ No newline at end of file +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_version_45, false) + +// If true, QuicSession::HasPendingCryptoData checks whether the crypto stream's +// send buffer is empty. This flag fixes a bug where the retransmission alarm +// mode is wrong for the first CHLO packet. +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_fix_has_pending_crypto_data, + false)
diff --git a/net/third_party/http2/platform/api/random_util_helper.h b/net/third_party/http2/platform/api/random_util_helper.h index 343f7ea..aced3b834 100644 --- a/net/third_party/http2/platform/api/random_util_helper.h +++ b/net/third_party/http2/platform/api/random_util_helper.h
@@ -7,8 +7,6 @@ namespace test { -class RandomBase; - inline Http2String RandomString(RandomBase* random, int len, Http2StringPiece alphabet) {
diff --git a/net/third_party/quic/core/qpack/qpack_constants.h b/net/third_party/quic/core/qpack/qpack_constants.h index 005d795..6ae0c9f 100644 --- a/net/third_party/quic/core/qpack/qpack_constants.h +++ b/net/third_party/quic/core/qpack/qpack_constants.h
@@ -15,6 +15,7 @@ // 5.4.2.1. Indexed Header Field const uint8_t kIndexedHeaderFieldOpcode = 0b10000000; const uint8_t kIndexedHeaderFieldOpcodeMask = 0b10000000; +const uint8_t kIndexedHeaderFieldStaticBit = 0b01000000; const uint8_t kIndexedHeaderFieldPrefixLength = 6; // 5.4.2.2. Indexed Header Field With Post-Base Index @@ -25,6 +26,7 @@ // 5.4.2.3. Literal Header Field With Name Reference const uint8_t kLiteralHeaderFieldNameReferenceOpcode = 0b01000000; const uint8_t kLiteralHeaderFieldNameReferenceOpcodeMask = 0b11000000; +const uint8_t kLiteralHeaderFieldNameReferenceStaticBit = 0b00010000; const uint8_t kLiteralHeaderFieldNameReferencePrefixLength = 4; // 5.4.2.4. Literal Header Field With Post-Base Name Reference
diff --git a/net/third_party/quic/core/qpack/qpack_decoder.cc b/net/third_party/quic/core/qpack/qpack_decoder.cc index a36d1dc2..e269855 100644 --- a/net/third_party/quic/core/qpack/qpack_decoder.cc +++ b/net/third_party/quic/core/qpack/qpack_decoder.cc
@@ -12,11 +12,15 @@ namespace quic { QpackDecoder::ProgressiveDecoder::ProgressiveDecoder( + QpackHeaderTable* header_table, QpackDecoder::HeadersHandlerInterface* handler) - : handler_(handler), - state_(State::kParseOpcode), + : header_table_(header_table), + handler_(handler), + state_(State::kStart), decoding_(true), error_detected_(false), + literal_name_(false), + literal_value_(false), name_length_(0), value_length_(0), is_huffman_(false) {} @@ -28,21 +32,18 @@ return; } - size_t bytes_consumed = 0; while (true) { + size_t bytes_consumed = 0; + switch (state_) { - case State::kParseOpcode: - bytes_consumed = DoParseOpcode(data); + case State::kStart: + bytes_consumed = DoStart(data); break; - case State::kNameLengthStart: - bytes_consumed = DoNameLengthStart(data); + case State::kVarintResume: + bytes_consumed = DoVarintResume(data); break; - case State::kNameLengthResume: - bytes_consumed = DoNameLengthResume(data); - break; - case State::kNameLengthDone: - DoNameLengthDone(); - bytes_consumed = 0; + case State::kVarintDone: + DoVarintDone(); break; case State::kNameString: bytes_consumed = DoNameString(data); @@ -55,14 +56,12 @@ break; case State::kValueLengthDone: DoValueLengthDone(); - bytes_consumed = 0; break; case State::kValueString: bytes_consumed = DoValueString(data); break; case State::kDone: DoDone(); - bytes_consumed = 0; break; } @@ -76,7 +75,7 @@ data.size() - bytes_consumed); // Stop processing if no more data but next state would require it. - if (data.empty() && (state_ != State::kNameLengthDone) && + if (data.empty() && (state_ != State::kVarintDone) && (state_ != State::kValueLengthDone) && (state_ != State::kDone)) { return; } @@ -91,77 +90,81 @@ return; } - if (state_ == State::kParseOpcode) { + if (state_ == State::kStart) { handler_->OnDecodingCompleted(); } else { OnError("Incomplete header block."); } } -// This method always returns 0 since some bits of the byte containing the -// opcode must be parsed by other methods. -size_t QpackDecoder::ProgressiveDecoder::DoParseOpcode(QuicStringPiece data) { +size_t QpackDecoder::ProgressiveDecoder::DoStart(QuicStringPiece data) { DCHECK(!data.empty()); + size_t prefix_length = 0; if ((data[0] & kIndexedHeaderFieldOpcodeMask) == kIndexedHeaderFieldOpcode) { - // TODO(bnc): Implement. - OnError("Indexed Header Field not implemented."); - return 0; - } - - if ((data[0] & kIndexedHeaderFieldPostBaseOpcodeMask) == - kIndexedHeaderFieldPostBaseOpcode) { + if ((data[0] & kIndexedHeaderFieldStaticBit) != + kIndexedHeaderFieldStaticBit) { + // TODO(bnc): Implement. + OnError("Indexed Header Field with dynamic entry not implemented."); + return 0; + } + prefix_length = kIndexedHeaderFieldPrefixLength; + literal_name_ = false; + literal_value_ = false; + } else if ((data[0] & kIndexedHeaderFieldPostBaseOpcodeMask) == + kIndexedHeaderFieldPostBaseOpcode) { // TODO(bnc): Implement. OnError("Indexed Header Field With Post-Base Index not implemented."); return 0; - } - - if ((data[0] & kLiteralHeaderFieldNameReferenceOpcodeMask) == - kLiteralHeaderFieldNameReferenceOpcode) { - // TODO(bnc): Implement. - OnError("Literal Header Field With Name Reference not implemented."); - return 0; - } - - if ((data[0] & kLiteralHeaderFieldPostBaseOpcodeMask) == - kLiteralHeaderFieldPostBaseOpcode) { + } else if ((data[0] & kLiteralHeaderFieldNameReferenceOpcodeMask) == + kLiteralHeaderFieldNameReferenceOpcode) { + if ((data[0] & kLiteralHeaderFieldNameReferenceStaticBit) != + kLiteralHeaderFieldNameReferenceStaticBit) { + // TODO(bnc): Implement. + OnError( + "Literal Header Field With Name Reference with dynamic entry not " + "implemented."); + return 0; + } + prefix_length = kLiteralHeaderFieldNameReferencePrefixLength; + literal_name_ = false; + literal_value_ = true; + } else if ((data[0] & kLiteralHeaderFieldPostBaseOpcodeMask) == + kLiteralHeaderFieldPostBaseOpcode) { // TODO(bnc): Implement. OnError( "Literal Header Field With Post-Base Name Reference not implemented."); return 0; + } else { + DCHECK_EQ(kLiteralHeaderFieldOpcode, + data[0] & kLiteralHeaderFieldOpcodeMask); + + is_huffman_ = + (data[0] & kLiteralNameHuffmanMask) == kLiteralNameHuffmanMask; + prefix_length = kLiteralHeaderFieldPrefixLength; + literal_name_ = true; + literal_value_ = true; } - DCHECK_EQ(kLiteralHeaderFieldOpcode, data[0] & kLiteralHeaderFieldOpcodeMask); - state_ = State::kNameLengthStart; - return 0; -} - -size_t QpackDecoder::ProgressiveDecoder::DoNameLengthStart( - QuicStringPiece data) { - DCHECK(!data.empty()); - - is_huffman_ = (data[0] & kLiteralNameHuffmanMask) == kLiteralNameHuffmanMask; - http2::DecodeBuffer buffer(data.data() + 1, data.size() - 1); http2::DecodeStatus status = - varint_decoder_.Start(data[0], kLiteralHeaderFieldPrefixLength, &buffer); + varint_decoder_.Start(data[0], prefix_length, &buffer); size_t bytes_consumed = 1 + buffer.Offset(); switch (status) { case http2::DecodeStatus::kDecodeDone: - state_ = State::kNameLengthDone; + state_ = State::kVarintDone; return bytes_consumed; case http2::DecodeStatus::kDecodeInProgress: - state_ = State::kNameLengthResume; + state_ = State::kVarintResume; return bytes_consumed; case http2::DecodeStatus::kDecodeError: - OnError("NameLen too large in literal header field without reference."); + OnError("Encoded integer too large."); return bytes_consumed; } } -size_t QpackDecoder::ProgressiveDecoder::DoNameLengthResume( - QuicStringPiece data) { +size_t QpackDecoder::ProgressiveDecoder::DoVarintResume(QuicStringPiece data) { DCHECK(!data.empty()); http2::DecodeBuffer buffer(data); @@ -170,34 +173,48 @@ size_t bytes_consumed = buffer.Offset(); switch (status) { case http2::DecodeStatus::kDecodeDone: - state_ = State::kNameLengthDone; + state_ = State::kVarintDone; return bytes_consumed; case http2::DecodeStatus::kDecodeInProgress: DCHECK_EQ(bytes_consumed, data.size()); DCHECK(buffer.Empty()); return bytes_consumed; case http2::DecodeStatus::kDecodeError: - OnError("NameLen too large in literal header field without reference."); + OnError("Encoded integer too large."); return bytes_consumed; } } -void QpackDecoder::ProgressiveDecoder::DoNameLengthDone() { - name_.clear(); - name_length_ = varint_decoder_.value(); +void QpackDecoder::ProgressiveDecoder::DoVarintDone() { + if (literal_name_) { + name_length_ = varint_decoder_.value(); + name_.clear(); + name_.reserve(name_length_); + state_ = State::kNameString; + return; + } - if (name_length_ == 0) { + auto entry = header_table_->LookupEntry(varint_decoder_.value()); + if (!entry) { + OnError("Invalid static table index."); + return; + } + + if (literal_value_) { + name_.assign(entry->name().data(), entry->name().size()); state_ = State::kValueLengthStart; return; } - name_.reserve(name_length_); - state_ = State::kNameString; + // Call OnHeaderDecoded() here instead of changing to State::kDone + // to prevent copying two strings. + handler_->OnHeaderDecoded(entry->name(), entry->value()); + state_ = State::kStart; } size_t QpackDecoder::ProgressiveDecoder::DoNameString(QuicStringPiece data) { DCHECK(!data.empty()); - DCHECK_LT(name_.size(), name_length_); + DCHECK_LE(name_.size(), name_length_); size_t bytes_consumed = std::min(name_length_ - name_.size(), data.size()); name_.append(data.data(), bytes_consumed); @@ -227,6 +244,7 @@ size_t QpackDecoder::ProgressiveDecoder::DoValueLengthStart( QuicStringPiece data) { DCHECK(!data.empty()); + DCHECK(literal_value_); is_huffman_ = (data[0] & kLiteralValueHuffmanMask) == kLiteralValueHuffmanMask; @@ -244,7 +262,7 @@ state_ = State::kValueLengthResume; return bytes_consumed; case http2::DecodeStatus::kDecodeError: - OnError("ValueLen too large in literal header field without reference."); + OnError("ValueLen too large."); return bytes_consumed; } } @@ -266,7 +284,7 @@ DCHECK(buffer.Empty()); return bytes_consumed; case http2::DecodeStatus::kDecodeError: - OnError("ValueLen too large in literal header field without reference."); + OnError("ValueLen too large."); return bytes_consumed; } } @@ -315,7 +333,7 @@ void QpackDecoder::ProgressiveDecoder::DoDone() { handler_->OnHeaderDecoded(name_, value_); - state_ = State::kParseOpcode; + state_ = State::kStart; } void QpackDecoder::ProgressiveDecoder::OnError(QuicStringPiece error_message) { @@ -328,7 +346,7 @@ std::unique_ptr<QpackDecoder::ProgressiveDecoder> QpackDecoder::DecodeHeaderBlock( QpackDecoder::HeadersHandlerInterface* handler) { - return std::make_unique<ProgressiveDecoder>(handler); + return std::make_unique<ProgressiveDecoder>(&header_table_, handler); } } // namespace quic
diff --git a/net/third_party/quic/core/qpack/qpack_decoder.h b/net/third_party/quic/core/qpack/qpack_decoder.h index 3ddc0ded..1aa554a 100644 --- a/net/third_party/quic/core/qpack/qpack_decoder.h +++ b/net/third_party/quic/core/qpack/qpack_decoder.h
@@ -9,6 +9,7 @@ #include "net/third_party/http2/hpack/huffman/hpack_huffman_decoder.h" #include "net/third_party/http2/hpack/varint/hpack_varint_decoder.h" +#include "net/third_party/quic/core/qpack/qpack_header_table.h" #include "net/third_party/quic/platform/api/quic_export.h" #include "net/third_party/quic/platform/api/quic_string.h" #include "net/third_party/quic/platform/api/quic_string_piece.h" @@ -48,7 +49,11 @@ // Class to decode a single header block. class QUIC_EXPORT_PRIVATE ProgressiveDecoder { public: - explicit ProgressiveDecoder(HeadersHandlerInterface* handler); + ProgressiveDecoder() = delete; + ProgressiveDecoder(QpackHeaderTable* header_table, + HeadersHandlerInterface* handler); + ProgressiveDecoder(const ProgressiveDecoder&) = delete; + ProgressiveDecoder& operator=(const ProgressiveDecoder&) = delete; ~ProgressiveDecoder() = default; // Provide a data fragment to decode. @@ -60,24 +65,27 @@ private: enum class State { - kParseOpcode, - kNameLengthStart, - kNameLengthResume, - kNameLengthDone, + // Every instruction starts encoding an integer on the first octet: + // either an index or the length of the name string literal. + kStart, + kVarintResume, + kVarintDone, + // This might be followed by the name as a string literal. kNameString, + // This might be followed by the length of the value. kValueLengthStart, kValueLengthResume, kValueLengthDone, + // This might be followed by the value as a string literal. kValueString, kDone, }; // One method for each state. Some take input data and return the number of // octets processed. Some only change internal state. - size_t DoParseOpcode(QuicStringPiece data); - size_t DoNameLengthStart(QuicStringPiece data); - size_t DoNameLengthResume(QuicStringPiece data); - void DoNameLengthDone(); + size_t DoStart(QuicStringPiece data); + size_t DoVarintResume(QuicStringPiece data); + void DoVarintDone(); size_t DoNameString(QuicStringPiece data); size_t DoValueLengthStart(QuicStringPiece data); size_t DoValueLengthResume(QuicStringPiece data); @@ -87,6 +95,7 @@ void OnError(QuicStringPiece error_message); + const QpackHeaderTable* const header_table_; HeadersHandlerInterface* handler_; State state_; http2::HpackVarintDecoder varint_decoder_; @@ -98,19 +107,28 @@ // True if a decoding error has been detected. bool error_detected_; - // Temporarily store decoded length for header name. - // Must be reset when header name is completely parsed. + // The following variables are used to carry information between states + // within a single header field. That is, a value assigned while decoding + // one header field shall never be used for decoding subsequent header + // fields. + + // True if the header field name is encoded as a string literal. + bool literal_name_; + + // True if the header field value is encoded as a string literal. + bool literal_value_; + + // Decoded length for header name. size_t name_length_; - // Temporarily store decoded length for header value. - // Must be reset when header value is completely parsed. + // Decoded length for header value. size_t value_length_; - // Temporarily store whether the currently parsed string (name or value) is + // Whether the currently parsed string (name or value) is // Huffman encoded. bool is_huffman_; - // Temporarily store decoded header name and value. + // Decoded header name and value. QuicString name_; QuicString value_; }; @@ -120,6 +138,9 @@ // is destroyed or the decoder calls |handler->OnHeaderBlockEnd()|. std::unique_ptr<ProgressiveDecoder> DecodeHeaderBlock( HeadersHandlerInterface* handler); + + private: + QpackHeaderTable header_table_; }; } // namespace quic
diff --git a/net/third_party/quic/core/qpack/qpack_decoder_test.cc b/net/third_party/quic/core/qpack/qpack_decoder_test.cc index 3b651fb..7465951 100644 --- a/net/third_party/quic/core/qpack/qpack_decoder_test.cc +++ b/net/third_party/quic/core/qpack/qpack_decoder_test.cc
@@ -9,8 +9,6 @@ #include "net/third_party/quic/platform/api/quic_test.h" #include "net/third_party/quic/platform/api/quic_text_utils.h" #include "net/third_party/spdy/core/spdy_header_block.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" using ::testing::StrictMock; using ::testing::Values; @@ -70,36 +68,43 @@ } TEST_P(QpackDecoderTest, EmptyName) { - EXPECT_CALL(handler_, OnHeaderDecoded("", "foo")); + EXPECT_CALL(handler_, + OnHeaderDecoded(QuicStringPiece(""), QuicStringPiece("foo"))); EXPECT_CALL(handler_, OnDecodingCompleted()); Decode(QuicTextUtils::HexDecode("2003666f6f")); } TEST_P(QpackDecoderTest, EmptyValue) { - EXPECT_CALL(handler_, OnHeaderDecoded("foo", "")); + EXPECT_CALL(handler_, + OnHeaderDecoded(QuicStringPiece("foo"), QuicStringPiece(""))); EXPECT_CALL(handler_, OnDecodingCompleted()); Decode(QuicTextUtils::HexDecode("23666f6f00")); } TEST_P(QpackDecoderTest, EmptyNameAndValue) { - EXPECT_CALL(handler_, OnHeaderDecoded("", "")); + EXPECT_CALL(handler_, + OnHeaderDecoded(QuicStringPiece(""), QuicStringPiece(""))); EXPECT_CALL(handler_, OnDecodingCompleted()); Decode(QuicTextUtils::HexDecode("2000")); } TEST_P(QpackDecoderTest, Simple) { - EXPECT_CALL(handler_, OnHeaderDecoded("foo", "bar")); + EXPECT_CALL(handler_, + OnHeaderDecoded(QuicStringPiece("foo"), QuicStringPiece("bar"))); EXPECT_CALL(handler_, OnDecodingCompleted()); Decode(QuicTextUtils::HexDecode("23666f6f03626172")); } TEST_P(QpackDecoderTest, Multiple) { - EXPECT_CALL(handler_, OnHeaderDecoded("foo", "bar")); - EXPECT_CALL(handler_, OnHeaderDecoded("foobaar", std::string(127, 'a'))); + EXPECT_CALL(handler_, + OnHeaderDecoded(QuicStringPiece("foo"), QuicStringPiece("bar"))); + QuicString str(127, 'a'); + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece("foobaar"), + QuicStringPiece(str))); EXPECT_CALL(handler_, OnDecodingCompleted()); Decode(QuicTextUtils::HexDecode( @@ -115,39 +120,56 @@ } TEST_P(QpackDecoderTest, NameLenTooLarge) { - EXPECT_CALL( - handler_, - OnDecodingErrorDetected( - "NameLen too large in literal header field without reference.")); + EXPECT_CALL(handler_, OnDecodingErrorDetected( + QuicStringPiece("Encoded integer too large."))); Decode(QuicTextUtils::HexDecode("27ffffffffff")); } TEST_P(QpackDecoderTest, ValueLenTooLarge) { - EXPECT_CALL( - handler_, - OnDecodingErrorDetected( - "ValueLen too large in literal header field without reference.")); + EXPECT_CALL(handler_, + OnDecodingErrorDetected(QuicStringPiece("ValueLen too large."))); Decode(QuicTextUtils::HexDecode("23666f6f7fffffffffff")); } TEST_P(QpackDecoderTest, IncompleteHeaderBlock) { - EXPECT_CALL(handler_, OnDecodingErrorDetected("Incomplete header block.")); + EXPECT_CALL(handler_, OnDecodingErrorDetected( + QuicStringPiece("Incomplete header block."))); Decode(QuicTextUtils::HexDecode("2366")); } TEST_P(QpackDecoderTest, HuffmanSimple) { - EXPECT_CALL(handler_, OnHeaderDecoded("custom-key", "custom-value")); + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece("custom-key"), + QuicStringPiece("custom-value"))); EXPECT_CALL(handler_, OnDecodingCompleted()); - Decode(QuicTextUtils::HexDecode("2f0125a849e95ba97d7f8925a849e95bb8e8b4bf")); + Decode(QuicTextUtils::HexDecode( + QuicStringPiece("2f0125a849e95ba97d7f8925a849e95bb8e8b4bf"))); +} + +TEST_P(QpackDecoderTest, AlternatingHuffmanNonHuffman) { + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece("custom-key"), + QuicStringPiece("custom-value"))) + .Times(4); + EXPECT_CALL(handler_, OnDecodingCompleted()); + + Decode(QuicTextUtils::HexDecode( + "2f0125a849e95ba97d7f" // Huffman-encoded name. + "8925a849e95bb8e8b4bf" // Huffman-encoded value. + "2703637573746f6d2d6b6579" // Non-Huffman encoded name. + "0c637573746f6d2d76616c7565" // Non-Huffman encoded value. + "2f0125a849e95ba97d7f" // Huffman-encoded name. + "0c637573746f6d2d76616c7565" // Non-Huffman encoded value. + "2703637573746f6d2d6b6579" // Non-Huffman encoded name. + "8925a849e95bb8e8b4bf" // Huffman-encoded value. + )); } TEST_P(QpackDecoderTest, HuffmanNameDoesNotHaveEOSPrefix) { - EXPECT_CALL(handler_, - OnDecodingErrorDetected("Error in Huffman-encoded name.")); + EXPECT_CALL(handler_, OnDecodingErrorDetected( + QuicStringPiece("Error in Huffman-encoded name."))); // 'y' ends in 0b0 on the most significant bit of the last byte. // The remaining 7 bits must be a prefix of EOS, which is all 1s. @@ -155,8 +177,8 @@ } TEST_P(QpackDecoderTest, HuffmanValueDoesNotHaveEOSPrefix) { - EXPECT_CALL(handler_, - OnDecodingErrorDetected("Error in Huffman-encoded value.")); + EXPECT_CALL(handler_, OnDecodingErrorDetected(QuicStringPiece( + "Error in Huffman-encoded value."))); // 'e' ends in 0b101, taking up the 3 most significant bits of the last byte. // The remaining 5 bits must be a prefix of EOS, which is all 1s. @@ -164,8 +186,8 @@ } TEST_P(QpackDecoderTest, HuffmanNameEOSPrefixTooLong) { - EXPECT_CALL(handler_, - OnDecodingErrorDetected("Error in Huffman-encoded name.")); + EXPECT_CALL(handler_, OnDecodingErrorDetected( + QuicStringPiece("Error in Huffman-encoded name."))); // The trailing EOS prefix must be at most 7 bits long. Appending one octet // with value 0xff is invalid, even though 0b111111111111111 (15 bits) is a @@ -175,8 +197,8 @@ } TEST_P(QpackDecoderTest, HuffmanValueEOSPrefixTooLong) { - EXPECT_CALL(handler_, - OnDecodingErrorDetected("Error in Huffman-encoded value.")); + EXPECT_CALL(handler_, OnDecodingErrorDetected(QuicStringPiece( + "Error in Huffman-encoded value."))); // The trailing EOS prefix must be at most 7 bits long. Appending one octet // with value 0xff is invalid, even though 0b1111111111111 (13 bits) is a @@ -185,6 +207,58 @@ QuicTextUtils::HexDecode("2f0125a849e95ba97d7f8a25a849e95bb8e8b4bfff")); } +TEST_P(QpackDecoderTest, StaticTable) { + // A header name that has multiple entries with different values. + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece(":method"), + QuicStringPiece("GET"))); + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece(":method"), + QuicStringPiece("POST"))); + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece(":method"), + QuicStringPiece("CONNECT"))); + + // A header name that has a single entry with non-empty value. + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece("accept-encoding"), + QuicStringPiece("gzip, deflate"))); + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece("accept-encoding"), + QuicStringPiece("brotli"))); + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece("accept-encoding"), + QuicStringPiece(""))); + + // A header name that has a single entry with empty value. + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece("cache-control"), + QuicStringPiece(""))); + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece("cache-control"), + QuicStringPiece("foo"))); + + EXPECT_CALL(handler_, OnDecodingCompleted()); + + Decode(QuicTextUtils::HexDecode( + "c2c35207434f4e4e454354d05f010662726f746c695f0100d85f0903666f6f")); +} + +TEST_P(QpackDecoderTest, TooLowStaticTableIndex) { + // This is the first entry in the static table with index 1. + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece(":authority"), + QuicStringPiece(""))); + + // Addressing entry 0 should trigger an error. + EXPECT_CALL(handler_, OnDecodingErrorDetected( + QuicStringPiece("Invalid static table index."))); + + Decode(QuicTextUtils::HexDecode("c1c0")); +} + +TEST_P(QpackDecoderTest, TooHighStaticTableIndex) { + // This is the last entry in the static table with index 61. + EXPECT_CALL(handler_, OnHeaderDecoded(QuicStringPiece("www-authenticate"), + QuicStringPiece(""))); + + // Addressing entry 62 should trigger an error. + EXPECT_CALL(handler_, OnDecodingErrorDetected( + QuicStringPiece("Invalid static table index."))); + + Decode(QuicTextUtils::HexDecode("fdfe")); +} } // namespace } // namespace test } // namespace quic
diff --git a/net/third_party/quic/core/qpack/qpack_encoder.cc b/net/third_party/quic/core/qpack/qpack_encoder.cc index c6f2346..0b5a77d 100644 --- a/net/third_party/quic/core/qpack/qpack_encoder.cc +++ b/net/third_party/quic/core/qpack/qpack_encoder.cc
@@ -19,7 +19,9 @@ // header block. class QpackProgressiveEncoder : public spdy::HpackEncoder::ProgressiveEncoder { public: - explicit QpackProgressiveEncoder(const spdy::SpdyHeaderBlock* header_list); + QpackProgressiveEncoder() = delete; + QpackProgressiveEncoder(QpackHeaderTable* header_table, + const spdy::SpdyHeaderBlock* header_list); QpackProgressiveEncoder(const QpackProgressiveEncoder&) = delete; QpackProgressiveEncoder& operator=(const QpackProgressiveEncoder&) = delete; ~QpackProgressiveEncoder() = default; @@ -32,26 +34,45 @@ private: enum class State { - kNameStart, - kNameLength, + // Every instruction starts encoding an integer on the first octet: + // either an index or the length of the name string literal. + kStart, + kVarintResume, + kVarintDone, + // This might be followed by the name as a string literal. kNameString, + // This might be followed by the length of the value. kValueStart, kValueLength, + // This might be followed by the value as a string literal. kValueString }; - // One method for each state. They each encode up to |max_encoded_bytes| - // octets, appending to |output|. - size_t DoNameStart(size_t max_encoded_bytes, QuicString* output); - size_t DoNameLength(size_t max_encoded_bytes, QuicString* output); + // One method for each state. Some encode up to |max_encoded_bytes| octets, + // appending to |output|. Some only change internal state. + size_t DoStart(size_t max_encoded_bytes, QuicString* output); + size_t DoVarintResume(size_t max_encoded_bytes, QuicString* output); + void DoVarintDone(); size_t DoNameString(size_t max_encoded_bytes, QuicString* output); size_t DoValueStart(size_t max_encoded_bytes, QuicString* output); size_t DoValueLength(size_t max_encoded_bytes, QuicString* output); size_t DoValueString(size_t max_encoded_bytes, QuicString* output); + const QpackHeaderTable* const header_table_; const spdy::SpdyHeaderBlock* const header_list_; spdy::SpdyHeaderBlock::const_iterator header_list_iterator_; State state_; + http2::HpackVarintEncoder varint_encoder_; + + // The following variables are used to carry information between states + // within a single header field. That is, a value assigned while encoding one + // header field shall never be used for encoding subsequent header fields. + + // True if the header field name is encoded as a string literal. + bool literal_name_; + + // True if the header field value is encoded as a string literal. + bool literal_value_; // While encoding a string literal, |string_to_write_| points to the substring // that remains to be written. This may be a substring of a string owned by @@ -61,15 +82,17 @@ // Storage for the Huffman encoded string literal to be written if Huffman // encoding is used. QuicString huffman_encoded_string_; - - http2::HpackVarintEncoder varint_encoder_; }; QpackProgressiveEncoder::QpackProgressiveEncoder( + QpackHeaderTable* header_table, const spdy::SpdyHeaderBlock* header_list) - : header_list_(header_list), + : header_table_(header_table), + header_list_(header_list), header_list_iterator_(header_list_->begin()), - state_(State::kNameStart) {} + state_(State::kStart), + literal_name_(false), + literal_value_(false) {} bool QpackProgressiveEncoder::HasNext() const { return header_list_iterator_ != header_list_->end(); @@ -81,15 +104,17 @@ DCHECK_NE(0u, max_encoded_bytes); while (max_encoded_bytes > 0 && HasNext()) { - State old_state = state_; size_t encoded_bytes = 0; switch (state_) { - case State::kNameStart: - encoded_bytes = DoNameStart(max_encoded_bytes, output); + case State::kStart: + encoded_bytes = DoStart(max_encoded_bytes, output); break; - case State::kNameLength: - encoded_bytes = DoNameLength(max_encoded_bytes, output); + case State::kVarintResume: + encoded_bytes = DoVarintResume(max_encoded_bytes, output); + break; + case State::kVarintDone: + DoVarintDone(); break; case State::kNameString: encoded_bytes = DoNameString(max_encoded_bytes, output); @@ -106,65 +131,99 @@ } DCHECK_LE(encoded_bytes, max_encoded_bytes); - - if (state_ == old_state) { - // Encoding stopped either because it has completed or the buffer is full. - DCHECK(encoded_bytes == max_encoded_bytes || !HasNext()); - - return; - } - max_encoded_bytes -= encoded_bytes; } } -size_t QpackProgressiveEncoder::DoNameStart(size_t max_encoded_bytes, - QuicString* output) { - string_to_write_ = header_list_iterator_->first; - http2::HuffmanEncode(string_to_write_, &huffman_encoded_string_); +size_t QpackProgressiveEncoder::DoStart(size_t max_encoded_bytes, + QuicString* output) { + QuicStringPiece name = header_list_iterator_->first; + QuicStringPiece value = header_list_iterator_->second; + size_t index; + auto match_type = header_table_->FindHeaderField(name, value, &index); - // Use Huffman encoding if it cuts down on size. - if (huffman_encoded_string_.size() < string_to_write_.size()) { - string_to_write_ = huffman_encoded_string_; - output->push_back(varint_encoder_.StartEncoding( - kLiteralHeaderFieldOpcode | kLiteralNameHuffmanMask, - kLiteralHeaderFieldPrefixLength, string_to_write_.size())); - } else { - output->push_back(varint_encoder_.StartEncoding( - kLiteralHeaderFieldOpcode, kLiteralHeaderFieldPrefixLength, - string_to_write_.size())); + switch (match_type) { + case QpackHeaderTable::MatchType::kNameAndValue: + literal_name_ = false; + literal_value_ = false; + + output->push_back(varint_encoder_.StartEncoding( + kIndexedHeaderFieldOpcode | kIndexedHeaderFieldStaticBit, + kIndexedHeaderFieldPrefixLength, index)); + + break; + case QpackHeaderTable::MatchType::kName: + literal_name_ = false; + literal_value_ = true; + + output->push_back(varint_encoder_.StartEncoding( + kLiteralHeaderFieldNameReferenceOpcode | + kLiteralHeaderFieldNameReferenceStaticBit, + kLiteralHeaderFieldNameReferencePrefixLength, index)); + + break; + case QpackHeaderTable::MatchType::kNoMatch: + literal_name_ = true; + literal_value_ = true; + + http2::HuffmanEncode(name, &huffman_encoded_string_); + + // Use Huffman encoding if it cuts down on size. + if (huffman_encoded_string_.size() < name.size()) { + string_to_write_ = huffman_encoded_string_; + output->push_back(varint_encoder_.StartEncoding( + kLiteralHeaderFieldOpcode | kLiteralNameHuffmanMask, + kLiteralHeaderFieldPrefixLength, string_to_write_.size())); + } else { + string_to_write_ = name; + output->push_back(varint_encoder_.StartEncoding( + kLiteralHeaderFieldOpcode, kLiteralHeaderFieldPrefixLength, + string_to_write_.size())); + } + break; } - if (varint_encoder_.IsEncodingInProgress()) { - state_ = State::kNameLength; - } else if (string_to_write_.empty()) { - state_ = State::kValueStart; - } else { - state_ = State::kNameString; - } - + state_ = varint_encoder_.IsEncodingInProgress() ? State::kVarintResume + : State::kVarintDone; return 1; } -size_t QpackProgressiveEncoder::DoNameLength(size_t max_encoded_bytes, - QuicString* output) { +size_t QpackProgressiveEncoder::DoVarintResume(size_t max_encoded_bytes, + QuicString* output) { DCHECK(varint_encoder_.IsEncodingInProgress()); - DCHECK(!string_to_write_.empty()); const size_t encoded_bytes = varint_encoder_.ResumeEncoding(max_encoded_bytes, output); if (varint_encoder_.IsEncodingInProgress()) { DCHECK_EQ(encoded_bytes, max_encoded_bytes); - } else { - DCHECK_LE(encoded_bytes, max_encoded_bytes); - state_ = State::kNameString; + return encoded_bytes; } + DCHECK_LE(encoded_bytes, max_encoded_bytes); + + state_ = State::kVarintDone; return encoded_bytes; } +void QpackProgressiveEncoder::DoVarintDone() { + if (literal_name_) { + state_ = State::kNameString; + return; + } + + if (literal_value_) { + state_ = State::kValueStart; + return; + } + + ++header_list_iterator_; + state_ = State::kStart; +} + size_t QpackProgressiveEncoder::DoNameString(size_t max_encoded_bytes, QuicString* output) { + DCHECK(literal_name_); + if (max_encoded_bytes < string_to_write_.size()) { const size_t encoded_bytes = max_encoded_bytes; QuicStrAppend(output, string_to_write_.substr(0, encoded_bytes)); @@ -180,6 +239,8 @@ size_t QpackProgressiveEncoder::DoValueStart(size_t max_encoded_bytes, QuicString* output) { + DCHECK(literal_value_); + string_to_write_ = header_list_iterator_->second; http2::HuffmanEncode(string_to_write_, &huffman_encoded_string_); @@ -195,22 +256,15 @@ string_to_write_.size())); } - if (varint_encoder_.IsEncodingInProgress()) { - state_ = State::kValueLength; - } else if (string_to_write_.empty()) { - ++header_list_iterator_; - state_ = State::kNameStart; - } else { - state_ = State::kValueString; - } - + state_ = varint_encoder_.IsEncodingInProgress() ? State::kValueLength + : State::kValueString; return 1; } size_t QpackProgressiveEncoder::DoValueLength(size_t max_encoded_bytes, QuicString* output) { + DCHECK(literal_value_); DCHECK(varint_encoder_.IsEncodingInProgress()); - DCHECK(!string_to_write_.empty()); const size_t encoded_bytes = varint_encoder_.ResumeEncoding(max_encoded_bytes, output); @@ -226,6 +280,8 @@ size_t QpackProgressiveEncoder::DoValueString(size_t max_encoded_bytes, QuicString* output) { + DCHECK(literal_value_); + if (max_encoded_bytes < string_to_write_.size()) { const size_t encoded_bytes = max_encoded_bytes; QuicStrAppend(output, string_to_write_.substr(0, encoded_bytes)); @@ -235,7 +291,7 @@ const size_t encoded_bytes = string_to_write_.size(); QuicStrAppend(output, string_to_write_); - state_ = State::kNameStart; + state_ = State::kStart; ++header_list_iterator_; return encoded_bytes; } @@ -244,7 +300,7 @@ std::unique_ptr<spdy::HpackEncoder::ProgressiveEncoder> QpackEncoder::EncodeHeaderSet(const spdy::SpdyHeaderBlock* header_list) { - return std::make_unique<QpackProgressiveEncoder>(header_list); + return std::make_unique<QpackProgressiveEncoder>(&header_table_, header_list); } } // namespace quic
diff --git a/net/third_party/quic/core/qpack/qpack_encoder.h b/net/third_party/quic/core/qpack/qpack_encoder.h index e582457..641753f 100644 --- a/net/third_party/quic/core/qpack/qpack_encoder.h +++ b/net/third_party/quic/core/qpack/qpack_encoder.h
@@ -8,6 +8,7 @@ #include <cstdint> #include <memory> +#include "net/third_party/quic/core/qpack/qpack_header_table.h" #include "net/third_party/quic/platform/api/quic_export.h" #include "net/third_party/spdy/core/hpack/hpack_encoder.h" #include "net/third_party/spdy/core/spdy_header_block.h" @@ -26,6 +27,9 @@ // during the lifetime of the returned ProgressiveEncoder instance. std::unique_ptr<spdy::HpackEncoder::ProgressiveEncoder> EncodeHeaderSet( const spdy::SpdyHeaderBlock* header_list); + + private: + QpackHeaderTable header_table_; }; } // namespace quic
diff --git a/net/third_party/quic/core/qpack/qpack_encoder_test.cc b/net/third_party/quic/core/qpack/qpack_encoder_test.cc index 6f0a24f5..2a2fd76 100644 --- a/net/third_party/quic/core/qpack/qpack_encoder_test.cc +++ b/net/third_party/quic/core/qpack/qpack_encoder_test.cc
@@ -95,6 +95,36 @@ output); } +TEST_P(QpackEncoderTest, StaticTable) { + { + spdy::SpdyHeaderBlock header_list; + header_list[":method"] = "GET"; + header_list["accept-encoding"] = "gzip, deflate"; + header_list["cache-control"] = ""; + + QuicString output = Encode(&header_list); + EXPECT_EQ(QuicTextUtils::HexDecode("c2d0d8"), output); + } + { + spdy::SpdyHeaderBlock header_list; + header_list[":method"] = "POST"; + header_list["accept-encoding"] = "brotli"; + header_list["cache-control"] = "foo"; + + QuicString output = Encode(&header_list); + DLOG(INFO) << QuicTextUtils::HexEncode(output); + EXPECT_EQ(QuicTextUtils::HexDecode("c35f01858ec3a6837f5f098294e7"), output); + } + { + spdy::SpdyHeaderBlock header_list; + header_list[":method"] = "CONNECT"; + header_list["accept-encoding"] = ""; + + QuicString output = Encode(&header_list); + EXPECT_EQ(QuicTextUtils::HexDecode("5207434f4e4e4543545f0100"), output); + } +} + } // namespace } // namespace test } // namespace quic
diff --git a/net/third_party/quic/core/qpack/qpack_header_table.cc b/net/third_party/quic/core/qpack/qpack_header_table.cc new file mode 100644 index 0000000..55c4f3a --- /dev/null +++ b/net/third_party/quic/core/qpack/qpack_header_table.cc
@@ -0,0 +1,55 @@ +#include "net/third_party/quic/core/qpack/qpack_header_table.h" + +#include "base/logging.h" +#include "net/third_party/spdy/core/hpack/hpack_constants.h" +#include "net/third_party/spdy/core/hpack/hpack_entry.h" +#include "net/third_party/spdy/core/hpack/hpack_static_table.h" + +namespace quic { + +// Currently using HPACK static tables. +// TODO(bnc): QPACK is likely to get its own static table. When this happens, +// fork HpackStaticTable code and modify static table. +QpackHeaderTable::QpackHeaderTable() + : static_entries_(spdy::ObtainHpackStaticTable().GetStaticEntries()), + static_index_(spdy::ObtainHpackStaticTable().GetStaticIndex()), + static_name_index_(spdy::ObtainHpackStaticTable().GetStaticNameIndex()) {} + +QpackHeaderTable::~QpackHeaderTable() = default; + +const spdy::HpackEntry* QpackHeaderTable::LookupEntry(size_t index) const { + // Static table indexing starts with 1. + if (index == 0 || index > static_entries_.size()) { + return nullptr; + } + + return &static_entries_[index - 1]; +} + +QpackHeaderTable::MatchType QpackHeaderTable::FindHeaderField( + QuicStringPiece name, + QuicStringPiece value, + size_t* index) const { + spdy::HpackEntry query(name, value); + UnorderedEntrySet::const_iterator static_index_it = + static_index_.find(&query); + if (static_index_it != static_index_.end()) { + DCHECK((*static_index_it)->IsStatic()); + // Static table indexing starts with 1. + *index = (*static_index_it)->InsertionIndex() + 1; + return MatchType::kNameAndValue; + } + + NameToEntryMap::const_iterator static_name_index_it = + static_name_index_.find(name); + if (static_name_index_it != static_name_index_.end()) { + DCHECK(static_name_index_it->second->IsStatic()); + // Static table indexing starts with 1. + *index = static_name_index_it->second->InsertionIndex() + 1; + return MatchType::kName; + } + + return MatchType::kNoMatch; +} + +} // namespace quic
diff --git a/net/third_party/quic/core/qpack/qpack_header_table.h b/net/third_party/quic/core/qpack/qpack_header_table.h new file mode 100644 index 0000000..5fa4554 --- /dev/null +++ b/net/third_party/quic/core/qpack/qpack_header_table.h
@@ -0,0 +1,56 @@ +#ifndef NET_THIRD_PARTY_QUIC_CORE_QPACK_QPACK_HEADER_TABLE_H_ +#define NET_THIRD_PARTY_QUIC_CORE_QPACK_QPACK_HEADER_TABLE_H_ + +#include <cstddef> + +#include "net/third_party/quic/platform/api/quic_export.h" +#include "net/third_party/quic/platform/api/quic_string_piece.h" +#include "net/third_party/spdy/core/hpack/hpack_header_table.h" + +namespace quic { + +// This class manages the QPACK static and dynamic tables. +// TODO(bnc): Implement dynamic table. +class QUIC_EXPORT_PRIVATE QpackHeaderTable { + public: + using EntryTable = spdy::HpackHeaderTable::EntryTable; + using EntryHasher = spdy::HpackHeaderTable::EntryHasher; + using EntriesEq = spdy::HpackHeaderTable::EntriesEq; + using UnorderedEntrySet = spdy::HpackHeaderTable::UnorderedEntrySet; + using NameToEntryMap = spdy::HpackHeaderTable::NameToEntryMap; + + // Result of header table lookup. + enum class MatchType { kNameAndValue, kName, kNoMatch }; + + QpackHeaderTable(); + QpackHeaderTable(const QpackHeaderTable&) = delete; + QpackHeaderTable& operator=(const QpackHeaderTable&) = delete; + + ~QpackHeaderTable(); + + // Returns the entry at given index, or nullptr on error. + const spdy::HpackEntry* LookupEntry(size_t index) const; + + // Returns the index of an entry with matching name and value if such exists, + // otherwise one with matching name is such exists. + MatchType FindHeaderField(QuicStringPiece name, + QuicStringPiece value, + size_t* index) const; + + private: + // |static_entries_|, |static_index_|, |static_name_index_| are owned by + // HpackStaticTable singleton. + + // Tracks HpackEntries by index. + const EntryTable& static_entries_; + + // Tracks the unique HpackEntry for a given header name and value. + const UnorderedEntrySet& static_index_; + + // Tracks the first static entry for each name in the static table. + const NameToEntryMap& static_name_index_; +}; + +} // namespace quic + +#endif // NET_THIRD_PARTY_QUIC_CORE_QPACK_QPACK_HEADER_TABLE_H_
diff --git a/net/third_party/quic/core/qpack/qpack_header_table_test.cc b/net/third_party/quic/core/qpack/qpack_header_table_test.cc new file mode 100644 index 0000000..f15073b --- /dev/null +++ b/net/third_party/quic/core/qpack/qpack_header_table_test.cc
@@ -0,0 +1,85 @@ +#include "net/third_party/quic/core/qpack/qpack_header_table.h" + +#include "net/third_party/quic/platform/api/quic_test.h" +#include "net/third_party/spdy/core/hpack/hpack_entry.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace quic { +namespace test { +namespace { + +class QpackHeaderTableTest : public QuicTest { + protected: + QpackHeaderTable table_; +}; + +TEST_F(QpackHeaderTableTest, LookupEntry) { + const auto* entry = table_.LookupEntry(0); + EXPECT_FALSE(entry); + + entry = table_.LookupEntry(1); + EXPECT_EQ(":authority", entry->name()); + EXPECT_EQ("", entry->value()); + + entry = table_.LookupEntry(2); + EXPECT_EQ(":method", entry->name()); + EXPECT_EQ("GET", entry->value()); + + entry = table_.LookupEntry(61); + EXPECT_EQ("www-authenticate", entry->name()); + EXPECT_EQ("", entry->value()); + + entry = table_.LookupEntry(62); + EXPECT_FALSE(entry); +} + +TEST_F(QpackHeaderTableTest, FindHeaderField) { + // A header name that has multiple entries with different values. + size_t index = 0; + QpackHeaderTable::MatchType matchtype = + table_.FindHeaderField(":method", "GET", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kNameAndValue, matchtype); + EXPECT_EQ(2u, index); + + matchtype = table_.FindHeaderField(":method", "POST", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kNameAndValue, matchtype); + EXPECT_EQ(3u, index); + + matchtype = table_.FindHeaderField(":method", "CONNECT", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kName, matchtype); + EXPECT_EQ(2u, index); + + // A header name that has a single entry with non-empty value. + matchtype = + table_.FindHeaderField("accept-encoding", "gzip, deflate", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kNameAndValue, matchtype); + EXPECT_EQ(16u, index); + + matchtype = table_.FindHeaderField("accept-encoding", "brotli", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kName, matchtype); + EXPECT_EQ(16u, index); + + matchtype = table_.FindHeaderField("accept-encoding", "", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kName, matchtype); + EXPECT_EQ(16u, index); + + // A header name that has a single entry with empty value. + matchtype = table_.FindHeaderField("cache-control", "", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kNameAndValue, matchtype); + EXPECT_EQ(24u, index); + + matchtype = table_.FindHeaderField("cache-control", "foo", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kName, matchtype); + EXPECT_EQ(24u, index); + + // No matching header name. + matchtype = table_.FindHeaderField("foo", "", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kNoMatch, matchtype); + + matchtype = table_.FindHeaderField("foo", "bar", &index); + EXPECT_EQ(QpackHeaderTable::MatchType::kNoMatch, matchtype); +} + +} // namespace +} // namespace test +} // namespace quic
diff --git a/net/third_party/quic/core/qpack/qpack_round_trip_test.cc b/net/third_party/quic/core/qpack/qpack_round_trip_test.cc index 8eddc86..b233929 100644 --- a/net/third_party/quic/core/qpack/qpack_round_trip_test.cc +++ b/net/third_party/quic/core/qpack/qpack_round_trip_test.cc
@@ -90,6 +90,41 @@ EXPECT_EQ(header_list, output); } +TEST_P(QpackRoundTripTest, StaticTable) { + { + spdy::SpdyHeaderBlock header_list; + header_list[":method"] = "GET"; + header_list["accept-encoding"] = "gzip, deflate"; + header_list["cache-control"] = ""; + header_list["foo"] = "bar"; + header_list[":path"] = "/"; + + spdy::SpdyHeaderBlock output = EncodeThenDecode(header_list); + EXPECT_EQ(header_list, output); + } + { + spdy::SpdyHeaderBlock header_list; + header_list[":method"] = "POST"; + header_list["accept-encoding"] = "brotli"; + header_list["cache-control"] = "foo"; + header_list["foo"] = "bar"; + header_list[":path"] = "/"; + + spdy::SpdyHeaderBlock output = EncodeThenDecode(header_list); + EXPECT_EQ(header_list, output); + } + { + spdy::SpdyHeaderBlock header_list; + header_list[":method"] = "CONNECT"; + header_list["accept-encoding"] = ""; + header_list["foo"] = "bar"; + header_list[":path"] = "/"; + + spdy::SpdyHeaderBlock output = EncodeThenDecode(header_list); + EXPECT_EQ(header_list, output); + } +} + } // namespace } // namespace test } // namespace quic
diff --git a/net/third_party/quic/core/qpack/qpack_test_utils.cc b/net/third_party/quic/core/qpack/qpack_test_utils.cc index 0ff7f16..ebddb4cf 100644 --- a/net/third_party/quic/core/qpack/qpack_test_utils.cc +++ b/net/third_party/quic/core/qpack/qpack_test_utils.cc
@@ -8,6 +8,7 @@ #include <limits> #include "net/third_party/quic/core/qpack/qpack_encoder.h" +#include "net/third_party/quic/platform/api/quic_test.h" namespace quic { namespace test {
diff --git a/net/third_party/quic/core/qpack/qpack_test_utils.h b/net/third_party/quic/core/qpack/qpack_test_utils.h index 06a60a2..ac0252f 100644 --- a/net/third_party/quic/core/qpack/qpack_test_utils.h +++ b/net/third_party/quic/core/qpack/qpack_test_utils.h
@@ -11,7 +11,6 @@ #include "net/third_party/quic/platform/api/quic_string.h" #include "net/third_party/quic/platform/api/quic_string_piece.h" #include "net/third_party/spdy/core/spdy_header_block.h" -#include "testing/gmock/include/gmock/gmock.h" namespace quic { namespace test {
diff --git a/net/third_party/quic/core/quic_crypto_stream_test.cc b/net/third_party/quic/core/quic_crypto_stream_test.cc index fc36169..b9b713d 100644 --- a/net/third_party/quic/core/quic_crypto_stream_test.cc +++ b/net/third_party/quic/core/quic_crypto_stream_test.cc
@@ -245,6 +245,25 @@ EXPECT_TRUE(stream_->RetransmitStreamData(0, 0, false)); } +// Regression test for b/115926584. +TEST_F(QuicCryptoStreamTest, HasUnackedCryptoData) { + QuicString data(1350, 'a'); + EXPECT_CALL(session_, WritevData(_, kCryptoStreamId, 1350, 0, _)) + .WillOnce(testing::Return(QuicConsumedData(0, false))); + stream_->WriteOrBufferData(data, false, nullptr); + EXPECT_FALSE(stream_->IsWaitingForAcks()); + // Although there is no outstanding data, verify session has pending crypto + // data. + EXPECT_EQ(GetQuicReloadableFlag(quic_fix_has_pending_crypto_data), + session_.HasUnackedCryptoData()); + + EXPECT_CALL(session_, WritevData(_, kCryptoStreamId, 1350, 0, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeData)); + stream_->OnCanWrite(); + EXPECT_TRUE(stream_->IsWaitingForAcks()); + EXPECT_TRUE(session_.HasUnackedCryptoData()); +} + } // namespace } // namespace test } // namespace quic
diff --git a/net/third_party/quic/core/quic_sent_packet_manager_test.cc b/net/third_party/quic/core/quic_sent_packet_manager_test.cc index e0efa8a5..10f6747 100644 --- a/net/third_party/quic/core/quic_sent_packet_manager_test.cc +++ b/net/third_party/quic/core/quic_sent_packet_manager_test.cc
@@ -100,7 +100,7 @@ EXPECT_CALL(*network_change_visitor_, OnPathMtuIncreased(1000)) .Times(AnyNumber()); EXPECT_CALL(notifier_, IsFrameOutstanding(_)).WillRepeatedly(Return(true)); - EXPECT_CALL(notifier_, HasPendingCryptoData()) + EXPECT_CALL(notifier_, HasUnackedCryptoData()) .WillRepeatedly(Return(false)); EXPECT_CALL(notifier_, OnStreamFrameRetransmitted(_)).Times(AnyNumber()); EXPECT_CALL(notifier_, OnFrameAcked(_, _)).WillRepeatedly(Return(true)); @@ -277,7 +277,7 @@ manager_.OnPacketSent(&packet, 0, clock_.Now(), NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); if (manager_.session_decides_what_to_write()) { - EXPECT_CALL(notifier_, HasPendingCryptoData()) + EXPECT_CALL(notifier_, HasUnackedCryptoData()) .WillRepeatedly(Return(true)); } } @@ -1037,7 +1037,7 @@ QuicPacketNumber acked[] = {3, 4, 5, 8, 9}; ExpectAcksAndLosses(true, acked, QUIC_ARRAYSIZE(acked), nullptr, 0); if (manager_.session_decides_what_to_write()) { - EXPECT_CALL(notifier_, HasPendingCryptoData()) + EXPECT_CALL(notifier_, HasUnackedCryptoData()) .WillRepeatedly(Return(false)); } manager_.OnAckFrameStart(9, QuicTime::Delta::Infinite(), clock_.Now()); @@ -1113,7 +1113,7 @@ manager_.OnAckRange(8, 10); EXPECT_TRUE(manager_.OnAckFrameEnd(clock_.Now())); if (manager_.session_decides_what_to_write()) { - EXPECT_CALL(notifier_, HasPendingCryptoData()) + EXPECT_CALL(notifier_, HasUnackedCryptoData()) .WillRepeatedly(Return(false)); } EXPECT_EQ(10u, manager_.GetLeastUnacked()); @@ -1149,7 +1149,7 @@ QuicPacketNumber acked[] = {2}; ExpectAcksAndLosses(true, acked, QUIC_ARRAYSIZE(acked), nullptr, 0); if (manager_.session_decides_what_to_write()) { - EXPECT_CALL(notifier_, HasPendingCryptoData()) + EXPECT_CALL(notifier_, HasUnackedCryptoData()) .WillRepeatedly(Return(false)); EXPECT_CALL(notifier_, IsFrameOutstanding(_)).WillRepeatedly(Return(false)); } @@ -1257,7 +1257,7 @@ // connection goes forward secure. manager_.NeuterUnencryptedPackets(); if (manager_.session_decides_what_to_write()) { - EXPECT_CALL(notifier_, HasPendingCryptoData()) + EXPECT_CALL(notifier_, HasUnackedCryptoData()) .WillRepeatedly(Return(false)); EXPECT_CALL(notifier_, IsFrameOutstanding(_)).WillRepeatedly(Return(false)); }
diff --git a/net/third_party/quic/core/quic_session.cc b/net/third_party/quic/core/quic_session.cc index dff75cc..0fbc1b6 100644 --- a/net/third_party/quic/core/quic_session.cc +++ b/net/third_party/quic/core/quic_session.cc
@@ -1165,8 +1165,17 @@ frame.stream_frame.fin); } -bool QuicSession::HasPendingCryptoData() const { - return GetStream(kCryptoStreamId)->IsWaitingForAcks(); +bool QuicSession::HasUnackedCryptoData() const { + const QuicStream* crypto_stream = GetCryptoStream(); + if (crypto_stream->IsWaitingForAcks()) { + return true; + } + if (GetQuicReloadableFlag(quic_fix_has_pending_crypto_data) && + crypto_stream->HasBufferedData()) { + QUIC_FLAG_COUNT(quic_reloadable_flag_quic_fix_has_pending_crypto_data); + return true; + } + return false; } WriteStreamDataResult QuicSession::WriteStreamData(QuicStreamId id,
diff --git a/net/third_party/quic/core/quic_session.h b/net/third_party/quic/core/quic_session.h index 3e8c2fa..86054d2 100644 --- a/net/third_party/quic/core/quic_session.h +++ b/net/third_party/quic/core/quic_session.h
@@ -135,7 +135,7 @@ void RetransmitFrames(const QuicFrames& frames, TransmissionType type) override; bool IsFrameOutstanding(const QuicFrame& frame) const override; - bool HasPendingCryptoData() const override; + bool HasUnackedCryptoData() const override; // Called on every incoming packet. Passes |packet| through to |connection_|. virtual void ProcessUdpPacket(const QuicSocketAddress& self_address,
diff --git a/net/third_party/quic/core/quic_unacked_packet_map.cc b/net/third_party/quic/core/quic_unacked_packet_map.cc index a6edfec..381bb87 100644 --- a/net/third_party/quic/core/quic_unacked_packet_map.cc +++ b/net/third_party/quic/core/quic_unacked_packet_map.cc
@@ -355,7 +355,7 @@ if (!session_decides_what_to_write_) { return pending_crypto_packet_count_ > 0; } - return session_notifier_->HasPendingCryptoData(); + return session_notifier_->HasUnackedCryptoData(); } bool QuicUnackedPacketMap::HasUnackedRetransmittableFrames() const {
diff --git a/net/third_party/quic/core/quic_unacked_packet_map.h b/net/third_party/quic/core/quic_unacked_packet_map.h index a12436d..50c829c 100644 --- a/net/third_party/quic/core/quic_unacked_packet_map.h +++ b/net/third_party/quic/core/quic_unacked_packet_map.h
@@ -145,7 +145,7 @@ // Returns true if there are any pending crypto packets. // TODO(fayang): Remove this method and call session_notifier_'s - // HasPendingCryptoData() when session_decides_what_to_write_ is default true. + // HasUnackedCryptoData() when session_decides_what_to_write_ is default true. bool HasPendingCryptoPackets() const; // Removes any retransmittable frames from this transmission or an associated
diff --git a/net/third_party/quic/core/session_notifier_interface.h b/net/third_party/quic/core/session_notifier_interface.h index 80159e8..e513184 100644 --- a/net/third_party/quic/core/session_notifier_interface.h +++ b/net/third_party/quic/core/session_notifier_interface.h
@@ -35,7 +35,7 @@ virtual bool IsFrameOutstanding(const QuicFrame& frame) const = 0; // Returns true if crypto stream is waiting for acks. - virtual bool HasPendingCryptoData() const = 0; + virtual bool HasUnackedCryptoData() const = 0; }; } // namespace quic
diff --git a/net/third_party/quic/test_tools/quic_test_utils.h b/net/third_party/quic/test_tools/quic_test_utils.h index 6df6c0e..7276b8cb 100644 --- a/net/third_party/quic/test_tools/quic_test_utils.h +++ b/net/third_party/quic/test_tools/quic_test_utils.h
@@ -1014,7 +1014,7 @@ MOCK_METHOD2(RetransmitFrames, void(const QuicFrames&, TransmissionType type)); MOCK_CONST_METHOD1(IsFrameOutstanding, bool(const QuicFrame&)); - MOCK_CONST_METHOD0(HasPendingCryptoData, bool()); + MOCK_CONST_METHOD0(HasUnackedCryptoData, bool()); }; // Creates a client session for testing.
diff --git a/net/third_party/quic/test_tools/simple_session_notifier.cc b/net/third_party/quic/test_tools/simple_session_notifier.cc index 88cebec8..68f654d 100644 --- a/net/third_party/quic/test_tools/simple_session_notifier.cc +++ b/net/third_party/quic/test_tools/simple_session_notifier.cc
@@ -316,11 +316,14 @@ (frame.stream_frame.fin && state.fin_outstanding); } -bool SimpleSessionNotifier::HasPendingCryptoData() const { +bool SimpleSessionNotifier::HasUnackedCryptoData() const { if (!QuicContainsKey(stream_map_, kCryptoStreamId)) { return false; } const auto& state = stream_map_.find(kCryptoStreamId)->second; + if (state.bytes_total > state.bytes_sent) { + return true; + } QuicIntervalSet<QuicStreamOffset> bytes_to_ack(0, state.bytes_total); bytes_to_ack.Difference(state.bytes_acked); return !bytes_to_ack.Empty();
diff --git a/net/third_party/quic/test_tools/simple_session_notifier.h b/net/third_party/quic/test_tools/simple_session_notifier.h index 5e8b882..4a62c5e9 100644 --- a/net/third_party/quic/test_tools/simple_session_notifier.h +++ b/net/third_party/quic/test_tools/simple_session_notifier.h
@@ -63,7 +63,7 @@ void RetransmitFrames(const QuicFrames& frames, TransmissionType type) override; bool IsFrameOutstanding(const QuicFrame& frame) const override; - bool HasPendingCryptoData() const override; + bool HasUnackedCryptoData() const override; private: struct StreamState {
diff --git a/net/third_party/quic/test_tools/simulator/quic_endpoint.cc b/net/third_party/quic/test_tools/simulator/quic_endpoint.cc index 5a5eb45f..af0d65fb 100644 --- a/net/third_party/quic/test_tools/simulator/quic_endpoint.cc +++ b/net/third_party/quic/test_tools/simulator/quic_endpoint.cc
@@ -273,7 +273,7 @@ return notifier_->IsFrameOutstanding(frame); } -bool QuicEndpoint::HasPendingCryptoData() const { +bool QuicEndpoint::HasUnackedCryptoData() const { return false; }
diff --git a/net/third_party/quic/test_tools/simulator/quic_endpoint.h b/net/third_party/quic/test_tools/simulator/quic_endpoint.h index 9f05b45..5daacf80 100644 --- a/net/third_party/quic/test_tools/simulator/quic_endpoint.h +++ b/net/third_party/quic/test_tools/simulator/quic_endpoint.h
@@ -117,7 +117,7 @@ void RetransmitFrames(const QuicFrames& frames, TransmissionType type) override; bool IsFrameOutstanding(const QuicFrame& frame) const override; - bool HasPendingCryptoData() const override; + bool HasUnackedCryptoData() const override; // End SessionNotifierInterface implementation. private:
diff --git a/services/identity/public/cpp/identity_manager.cc b/services/identity/public/cpp/identity_manager.cc index 996a61ef..123c8ff 100644 --- a/services/identity/public/cpp/identity_manager.cc +++ b/services/identity/public/cpp/identity_manager.cc
@@ -129,14 +129,26 @@ #endif // defined(OS_CHROMEOS) std::vector<AccountInfo> IdentityManager::GetAccountsWithRefreshTokens() const { - // TODO(blundell): It seems wasteful to construct this vector every time this - // method is called, but it also seems bad to maintain the vector as an ivar - // along the map. - std::vector<AccountInfo> accounts; - accounts.reserve(accounts_with_refresh_tokens_.size()); + std::vector<std::string> account_ids_with_tokens = + token_service_->GetAccounts(); - for (const auto& pair : accounts_with_refresh_tokens_) { - accounts.push_back(pair.second); + std::vector<AccountInfo> accounts; + accounts.reserve(account_ids_with_tokens.size()); + + for (const std::string& account_id : account_ids_with_tokens) { + AccountInfo account_info = + account_tracker_service_->GetAccountInfo(account_id); + + DCHECK(!account_info.IsEmpty() || account_id == kSupervisedUserPseudoEmail); + if (account_id == kSupervisedUserPseudoEmail && account_info.IsEmpty()) { + // Populate the information manually to maintain the invariant that the + // account ID, gaia ID, and email are always set. + account_info.account_id = account_id; + account_info.email = kSupervisedUserPseudoEmail; + account_info.gaia = kSupervisedUserPseudoGaiaID; + } + + accounts.push_back(account_info); } return accounts; @@ -155,7 +167,7 @@ bool IdentityManager::HasAccountWithRefreshToken( const std::string& account_id) const { - return base::ContainsKey(accounts_with_refresh_tokens_, account_id); + return token_service_->RefreshTokenIsAvailable(account_id); } bool IdentityManager::HasPrimaryAccountWithRefreshToken() const {
diff --git a/services/network/tcp_bound_socket_unittest.cc b/services/network/tcp_bound_socket_unittest.cc index 6d8ba7e5..a4d86ca 100644 --- a/services/network/tcp_bound_socket_unittest.cc +++ b/services/network/tcp_bound_socket_unittest.cc
@@ -40,7 +40,7 @@ SocketFactory* factory() { return &factory_; } int BindSocket(const net::IPEndPoint& ip_endpoint_in, - network::mojom::TCPBoundSocketPtr* bound_socket, + mojom::TCPBoundSocketPtr* bound_socket, net::IPEndPoint* ip_endpoint_out) { base::RunLoop run_loop; int bind_result = net::ERR_IO_PENDING; @@ -70,8 +70,8 @@ return bind_result; } - int Listen(network::mojom::TCPBoundSocketPtr bound_socket, - network::mojom::TCPServerSocketPtr* server_socket) { + int Listen(mojom::TCPBoundSocketPtr bound_socket, + mojom::TCPServerSocketPtr* server_socket) { base::RunLoop bound_socket_destroyed_run_loop; bound_socket.set_connection_error_handler( bound_socket_destroyed_run_loop.QuitClosure()); @@ -99,11 +99,11 @@ return listen_result; } - int Connect(network::mojom::TCPBoundSocketPtr bound_socket, + int Connect(mojom::TCPBoundSocketPtr bound_socket, const net::IPEndPoint& expected_local_addr, const net::IPEndPoint& connect_to_addr, - network::mojom::TCPConnectedSocketPtr* connected_socket, - network::mojom::SocketObserverPtr socket_observer, + mojom::TCPConnectedSocketPtr* connected_socket, + mojom::SocketObserverPtr socket_observer, mojo::ScopedDataPipeConsumerHandle* client_socket_receive_handle, mojo::ScopedDataPipeProducerHandle* client_socket_send_handle) { base::RunLoop bound_socket_destroyed_run_loop; @@ -193,20 +193,23 @@ // Try to bind a socket to an address already being listened on, which should // fail. -TEST_F(TCPBoundSocketTest, DISABLED_BindError) { +TEST_F(TCPBoundSocketTest, BindError) { // Set up a listening socket. - network::mojom::TCPBoundSocketPtr bound_socket1; + mojom::TCPBoundSocketPtr bound_socket1; net::IPEndPoint bound_address1; ASSERT_EQ(net::OK, BindSocket(LocalHostWithAnyPort(), &bound_socket1, &bound_address1)); - network::mojom::TCPServerSocketPtr server_socket; + mojom::TCPServerSocketPtr server_socket; ASSERT_EQ(net::OK, Listen(std::move(bound_socket1), &server_socket)); // Try to bind another socket to the listening socket's address. - network::mojom::TCPBoundSocketPtr bound_socket2; + mojom::TCPBoundSocketPtr bound_socket2; net::IPEndPoint bound_address2; - EXPECT_EQ(net::ERR_ADDRESS_IN_USE, - BindSocket(bound_address1, &bound_socket2, &bound_address2)); + int result = BindSocket(bound_address1, &bound_socket2, &bound_address2); + // Depending on platform, can get different errors. Some platforms can return + // either error. + EXPECT_TRUE(result == net::ERR_ADDRESS_IN_USE || + result == net::ERR_INVALID_ARGUMENT); } // Test the case of a connect error. To cause a connect error, bind a socket, @@ -217,23 +220,23 @@ // on OSX (after 25+ seconds) instead of connection refused. #if !defined(OS_MACOSX) && !defined(OS_IOS) TEST_F(TCPBoundSocketTest, ConnectError) { - network::mojom::TCPBoundSocketPtr bound_socket1; + mojom::TCPBoundSocketPtr bound_socket1; net::IPEndPoint bound_address1; ASSERT_EQ(net::OK, BindSocket(LocalHostWithAnyPort(), &bound_socket1, &bound_address1)); // Trying to bind to an address currently being used for listening should // fail. - network::mojom::TCPBoundSocketPtr bound_socket2; + mojom::TCPBoundSocketPtr bound_socket2; net::IPEndPoint bound_address2; ASSERT_EQ(net::OK, BindSocket(LocalHostWithAnyPort(), &bound_socket2, &bound_address2)); - network::mojom::TCPConnectedSocketPtr connected_socket; + mojom::TCPConnectedSocketPtr connected_socket; mojo::ScopedDataPipeConsumerHandle client_socket_receive_handle; mojo::ScopedDataPipeProducerHandle client_socket_send_handle; EXPECT_EQ(net::ERR_CONNECTION_REFUSED, Connect(std::move(bound_socket2), bound_address2, bound_address1, - &connected_socket, network::mojom::SocketObserverPtr(), + &connected_socket, mojom::SocketObserverPtr(), &client_socket_receive_handle, &client_socket_send_handle)); } #endif // !defined(OS_MACOSX) && !defined(OS_IOS) @@ -247,47 +250,50 @@ // Apple platforms don't allow binding multiple TCP sockets to the same port // even with SO_REUSEADDR enabled. #if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_IOS) -TEST_F(TCPBoundSocketTest, DISABLED_ListenError) { +TEST_F(TCPBoundSocketTest, ListenError) { // Bind a socket. - network::mojom::TCPBoundSocketPtr bound_socket1; + mojom::TCPBoundSocketPtr bound_socket1; net::IPEndPoint bound_address1; ASSERT_EQ(net::OK, BindSocket(LocalHostWithAnyPort(), &bound_socket1, &bound_address1)); // Bind another socket to the same address, which should succeed, due to // SO_REUSEADDR. - network::mojom::TCPBoundSocketPtr bound_socket2; + mojom::TCPBoundSocketPtr bound_socket2; net::IPEndPoint bound_address2; ASSERT_EQ(net::OK, BindSocket(bound_address1, &bound_socket2, &bound_address2)); // Listen on the first socket, which should also succeed. - network::mojom::TCPServerSocketPtr server_socket1; + mojom::TCPServerSocketPtr server_socket1; ASSERT_EQ(net::OK, Listen(std::move(bound_socket1), &server_socket1)); // Listen on the second socket should fail. - network::mojom::TCPServerSocketPtr server_socket2; - ASSERT_EQ(net::ERR_ADDRESS_IN_USE, - Listen(std::move(bound_socket2), &server_socket2)); + mojom::TCPServerSocketPtr server_socket2; + int result = Listen(std::move(bound_socket2), &server_socket2); + // Depending on platform, can get different errors. Some platforms can return + // either error. + EXPECT_TRUE(result == net::ERR_ADDRESS_IN_USE || + result == net::ERR_INVALID_ARGUMENT); } #endif // !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_IOS) // Test the case bind succeeds, and transfer some data. TEST_F(TCPBoundSocketTest, ReadWrite) { // Set up a listening socket. - network::mojom::TCPBoundSocketPtr bound_socket1; + mojom::TCPBoundSocketPtr bound_socket1; net::IPEndPoint server_address; ASSERT_EQ(net::OK, BindSocket(LocalHostWithAnyPort(), &bound_socket1, &server_address)); - network::mojom::TCPServerSocketPtr server_socket; + mojom::TCPServerSocketPtr server_socket; ASSERT_EQ(net::OK, Listen(std::move(bound_socket1), &server_socket)); // Connect to the socket with another socket. - network::mojom::TCPBoundSocketPtr bound_socket2; + mojom::TCPBoundSocketPtr bound_socket2; net::IPEndPoint client_address; ASSERT_EQ(net::OK, BindSocket(LocalHostWithAnyPort(), &bound_socket2, &client_address)); - network::mojom::TCPConnectedSocketPtr client_socket; + mojom::TCPConnectedSocketPtr client_socket; TestSocketObserver socket_observer; mojo::ScopedDataPipeConsumerHandle client_socket_receive_handle; mojo::ScopedDataPipeProducerHandle client_socket_send_handle; @@ -297,14 +303,14 @@ &client_socket_receive_handle, &client_socket_send_handle)); base::RunLoop run_loop; - network::mojom::TCPConnectedSocketPtr accept_socket; + mojom::TCPConnectedSocketPtr accept_socket; mojo::ScopedDataPipeConsumerHandle accept_socket_receive_handle; mojo::ScopedDataPipeProducerHandle accept_socket_send_handle; server_socket->Accept( nullptr /* ovserver */, base::BindLambdaForTesting( [&](int net_error, const base::Optional<net::IPEndPoint>& remote_addr, - network::mojom::TCPConnectedSocketPtr connected_socket, + mojom::TCPConnectedSocketPtr connected_socket, mojo::ScopedDataPipeConsumerHandle receive_stream, mojo::ScopedDataPipeProducerHandle send_stream) { EXPECT_EQ(net_error, net::OK);
diff --git a/services/network/test/test_url_loader_factory.cc b/services/network/test/test_url_loader_factory.cc index 9cd09681..627738b 100644 --- a/services/network/test/test_url_loader_factory.cc +++ b/services/network/test/test_url_loader_factory.cc
@@ -87,6 +87,15 @@ return pending; } +TestURLLoaderFactory::PendingRequest* TestURLLoaderFactory::GetPendingRequest( + size_t index) { + if (index >= pending_requests_.size()) + return nullptr; + auto* request = &(pending_requests_[index]); + DCHECK(request); + return request; +} + void TestURLLoaderFactory::ClearResponses() { responses_.clear(); }
diff --git a/services/network/test/test_url_loader_factory.h b/services/network/test/test_url_loader_factory.h index f2153dac..4942418 100644 --- a/services/network/test/test_url_loader_factory.h +++ b/services/network/test/test_url_loader_factory.h
@@ -92,6 +92,10 @@ // servicing requests themselves, whenever possible. std::vector<PendingRequest>* pending_requests() { return &pending_requests_; } + // Returns the PendingRequest instance available at the given index |index| + // or null if not existing. + PendingRequest* GetPendingRequest(size_t index); + // Sends a response for the first (oldest) pending request with URL |url|. // Returns false if no such pending request exists. // |flags| can be used to change the default behavior:
diff --git a/services/network/url_loader_unittest.cc b/services/network/url_loader_unittest.cc index 50ad6dd7..320a91e 100644 --- a/services/network/url_loader_unittest.cc +++ b/services/network/url_loader_unittest.cc
@@ -30,6 +30,7 @@ #include "base/time/time.h" #include "build/build_config.h" #include "mojo/public/c/system/data_pipe.h" +#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/system/data_pipe_utils.h" #include "mojo/public/cpp/system/wait.h" #include "net/base/io_buffer.h" @@ -37,6 +38,7 @@ #include "net/base/mime_sniffer.h" #include "net/base/net_errors.h" #include "net/http/http_response_info.h" +#include "net/ssl/client_cert_identity_test_util.h" #include "net/test/cert_test_util.h" #include "net/test/embedded_test_server/controllable_http_response.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -627,6 +629,8 @@ return sent_request_; } + void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + static constexpr int kProcessId = 4; static constexpr int kRouteId = 8; @@ -1984,12 +1988,43 @@ unowned_power_monitor_source->Resume(); } -// A mock NetworkServiceClient that responds auth challenges with previously -// set credentials. -class TestAuthNetworkServiceClient : public mojom::NetworkServiceClient { +class FakeSSLPrivateKeyImpl : public network::mojom::SSLPrivateKey { public: - TestAuthNetworkServiceClient() = default; - ~TestAuthNetworkServiceClient() override = default; + explicit FakeSSLPrivateKeyImpl( + scoped_refptr<net::SSLPrivateKey> ssl_private_key) + : ssl_private_key_(std::move(ssl_private_key)) {} + ~FakeSSLPrivateKeyImpl() override {} + + // network::mojom::SSLPrivateKey: + void Sign(uint16_t algorithm, + const std::vector<uint8_t>& input, + network::mojom::SSLPrivateKey::SignCallback callback) override { + base::span<const uint8_t> input_span(input); + ssl_private_key_->Sign( + algorithm, input_span, + base::BindOnce(&FakeSSLPrivateKeyImpl::Callback, base::Unretained(this), + std::move(callback))); + } + + private: + void Callback(network::mojom::SSLPrivateKey::SignCallback callback, + net::Error net_error, + const std::vector<uint8_t>& signature) { + std::move(callback).Run(static_cast<int32_t>(net_error), signature); + } + + scoped_refptr<net::SSLPrivateKey> ssl_private_key_; + + DISALLOW_COPY_AND_ASSIGN(FakeSSLPrivateKeyImpl); +}; + +// A mock NetworkServiceClient that does the following: +// 1. Responds auth challenges with previously set credentials. +// 2. Responds certificate request with previously set responses. +class MockNetworkServiceClient : public mojom::NetworkServiceClient { + public: + MockNetworkServiceClient() = default; + ~MockNetworkServiceClient() override = default; enum class CredentialsResponse { NO_CREDENTIALS, @@ -1997,6 +2032,15 @@ INCORRECT_CREDENTIALS_THEN_CORRECT_ONES, }; + enum class CertificateResponse { + INVALID = -1, + URL_LOADER_REQUEST_CANCELLED, + CANCEL_CERTIFICATE_SELECTION, + NULL_CERTIFICATE, + VALID_CERTIFICATE_SIGNATURE, + INVALID_CERTIFICATE_SIGNATURE, + }; + // mojom::NetworkServiceClient: void OnAuthRequired( uint32_t process_id, @@ -2035,7 +2079,30 @@ const scoped_refptr<net::SSLCertRequestInfo>& cert_info, mojom::NetworkServiceClient::OnCertificateRequestedCallback callback) override { - NOTREACHED(); + switch (certificate_response_) { + case CertificateResponse::INVALID: + NOTREACHED(); + break; + case CertificateResponse::URL_LOADER_REQUEST_CANCELLED: + ASSERT_TRUE(url_loader_ptr_); + url_loader_ptr_->reset(); + break; + case CertificateResponse::CANCEL_CERTIFICATE_SELECTION: + std::move(callback).Run(nullptr, std::vector<uint16_t>(), nullptr, + true /* cancel_certificate_selection */); + break; + case CertificateResponse::NULL_CERTIFICATE: + std::move(callback).Run(nullptr, std::vector<uint16_t>(), nullptr, + false /* cancel_certificate_selection */); + break; + case CertificateResponse::VALID_CERTIFICATE_SIGNATURE: + case CertificateResponse::INVALID_CERTIFICATE_SIGNATURE: + std::move(callback).Run(std::move(certificate_), algorithm_preferences_, + std::move(ssl_private_key_ptr_), + false /* cancel_certificate_selection */); + break; + } + ++on_certificate_requested_counter_; } void OnSSLCertificateError(uint32_t process_id, @@ -2096,19 +2163,51 @@ return last_seen_response_headers_.get(); } + void set_certificate_response(CertificateResponse certificate_response) { + certificate_response_ = certificate_response; + } + + void set_url_loader_ptr(mojom::URLLoaderPtr* url_loader_ptr) { + url_loader_ptr_ = url_loader_ptr; + } + + void set_private_key(scoped_refptr<net::SSLPrivateKey> ssl_private_key) { + ssl_private_key_ = std::move(ssl_private_key); + algorithm_preferences_ = ssl_private_key_->GetAlgorithmPreferences(); + auto ssl_private_key_request = mojo::MakeRequest(&ssl_private_key_ptr_); + mojo::MakeStrongBinding( + std::make_unique<FakeSSLPrivateKeyImpl>(std::move(ssl_private_key_)), + std::move(ssl_private_key_request)); + } + + void set_certificate(scoped_refptr<net::X509Certificate> certificate) { + certificate_ = std::move(certificate); + } + + int on_certificate_requested_counter() { + return on_certificate_requested_counter_; + } + private: CredentialsResponse credentials_response_; base::Optional<net::AuthCredentials> auth_credentials_; int on_auth_required_call_counter_ = 0; scoped_refptr<net::HttpResponseHeaders> last_seen_response_headers_; + CertificateResponse certificate_response_ = CertificateResponse::INVALID; + mojom::URLLoaderPtr* url_loader_ptr_ = nullptr; + scoped_refptr<net::SSLPrivateKey> ssl_private_key_; + scoped_refptr<net::X509Certificate> certificate_; + network::mojom::SSLPrivateKeyPtr ssl_private_key_ptr_; + std::vector<uint16_t> algorithm_preferences_; + int on_certificate_requested_counter_ = 0; - DISALLOW_COPY_AND_ASSIGN(TestAuthNetworkServiceClient); + DISALLOW_COPY_AND_ASSIGN(MockNetworkServiceClient); }; TEST_F(URLLoaderTest, SetAuth) { - TestAuthNetworkServiceClient network_service_client; + MockNetworkServiceClient network_service_client; network_service_client.set_credentials_response( - TestAuthNetworkServiceClient::CredentialsResponse::CORRECT_CREDENTIALS); + MockNetworkServiceClient::CredentialsResponse::CORRECT_CREDENTIALS); ResourceRequest request = CreateResourceRequest("GET", test_server()->GetURL(kTestAuthURL)); @@ -2147,9 +2246,9 @@ } TEST_F(URLLoaderTest, CancelAuth) { - TestAuthNetworkServiceClient network_service_client; + MockNetworkServiceClient network_service_client; network_service_client.set_credentials_response( - TestAuthNetworkServiceClient::CredentialsResponse::NO_CREDENTIALS); + MockNetworkServiceClient::CredentialsResponse::NO_CREDENTIALS); ResourceRequest request = CreateResourceRequest("GET", test_server()->GetURL(kTestAuthURL)); @@ -2188,9 +2287,9 @@ } TEST_F(URLLoaderTest, TwoChallenges) { - TestAuthNetworkServiceClient network_service_client; + MockNetworkServiceClient network_service_client; network_service_client.set_credentials_response( - TestAuthNetworkServiceClient::CredentialsResponse:: + MockNetworkServiceClient::CredentialsResponse:: INCORRECT_CREDENTIALS_THEN_CORRECT_ONES); ResourceRequest request = @@ -2232,9 +2331,9 @@ TEST_F(URLLoaderTest, NoAuthRequiredForFavicon) { constexpr char kFaviconTestPage[] = "/has_favicon.html"; - TestAuthNetworkServiceClient network_service_client; + MockNetworkServiceClient network_service_client; network_service_client.set_credentials_response( - TestAuthNetworkServiceClient::CredentialsResponse::CORRECT_CREDENTIALS); + MockNetworkServiceClient::CredentialsResponse::CORRECT_CREDENTIALS); ResourceRequest request = CreateResourceRequest("GET", test_server()->GetURL(kFaviconTestPage)); @@ -2274,9 +2373,9 @@ } TEST_F(URLLoaderTest, HttpAuthResponseHeadersAvailable) { - TestAuthNetworkServiceClient network_service_client; + MockNetworkServiceClient network_service_client; network_service_client.set_credentials_response( - TestAuthNetworkServiceClient::CredentialsResponse::CORRECT_CREDENTIALS); + MockNetworkServiceClient::CredentialsResponse::CORRECT_CREDENTIALS); ResourceRequest request = CreateResourceRequest("GET", test_server()->GetURL(kTestAuthURL)); @@ -2454,4 +2553,276 @@ delete_run_loop.Run(); } +class TestSSLPrivateKey : public net::SSLPrivateKey { + public: + explicit TestSSLPrivateKey(scoped_refptr<net::SSLPrivateKey> key) + : key_(std::move(key)) {} + + void set_fail_signing(bool fail_signing) { fail_signing_ = fail_signing; } + int sign_count() const { return sign_count_; } + + std::vector<uint16_t> GetAlgorithmPreferences() override { + return key_->GetAlgorithmPreferences(); + } + void Sign(uint16_t algorithm, + base::span<const uint8_t> input, + SignCallback callback) override { + sign_count_++; + if (fail_signing_) { + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), + net::ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED, + std::vector<uint8_t>())); + } else { + key_->Sign(algorithm, input, std::move(callback)); + } + } + + private: + ~TestSSLPrivateKey() override = default; + + scoped_refptr<net::SSLPrivateKey> key_; + bool fail_signing_ = false; + int sign_count_ = 0; + + DISALLOW_COPY_AND_ASSIGN(TestSSLPrivateKey); +}; + +#if !defined(OS_IOS) +TEST_F(URLLoaderTest, ClientAuthCancelConnection) { + net::EmbeddedTestServer test_server(net::EmbeddedTestServer::TYPE_HTTPS); + net::SSLServerConfig ssl_config; + ssl_config.client_cert_type = + net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; + test_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); + test_server.AddDefaultHandlers( + base::FilePath(FILE_PATH_LITERAL("services/test/data"))); + ASSERT_TRUE(test_server.Start()); + + MockNetworkServiceClient network_service_client; + network_service_client.set_certificate_response( + MockNetworkServiceClient::CertificateResponse:: + URL_LOADER_REQUEST_CANCELLED); + + ResourceRequest request = + CreateResourceRequest("GET", test_server.GetURL("/defaultresponse")); + base::RunLoop delete_run_loop; + mojom::URLLoaderPtr loader; + mojom::URLLoaderFactoryParams params; + params.process_id = kProcessId; + params.is_corb_enabled = false; + std::unique_ptr<URLLoader> url_loader = std::make_unique<URLLoader>( + context(), &network_service_client, + DeleteLoaderCallback(&delete_run_loop, &url_loader), + mojo::MakeRequest(&loader), 0, request, false, + client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS, ¶ms, + 0 /* request_id */, resource_scheduler_client(), nullptr, + nullptr /* network_usage_accumulator */); + network_service_client.set_url_loader_ptr(&loader); + + RunUntilIdle(); + ASSERT_TRUE(url_loader); + + client()->RunUntilComplete(); + + EXPECT_EQ(net::ERR_FAILED, client()->completion_status().error_code); +} + +TEST_F(URLLoaderTest, ClientAuthCancelCertificateSelection) { + net::EmbeddedTestServer test_server(net::EmbeddedTestServer::TYPE_HTTPS); + net::SSLServerConfig ssl_config; + ssl_config.client_cert_type = + net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; + test_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); + test_server.AddDefaultHandlers( + base::FilePath(FILE_PATH_LITERAL("services/test/data"))); + ASSERT_TRUE(test_server.Start()); + + MockNetworkServiceClient network_service_client; + network_service_client.set_certificate_response( + MockNetworkServiceClient::CertificateResponse:: + CANCEL_CERTIFICATE_SELECTION); + + ResourceRequest request = + CreateResourceRequest("GET", test_server.GetURL("/defaultresponse")); + base::RunLoop delete_run_loop; + mojom::URLLoaderPtr loader; + mojom::URLLoaderFactoryParams params; + params.process_id = kProcessId; + params.is_corb_enabled = false; + std::unique_ptr<URLLoader> url_loader = std::make_unique<URLLoader>( + context(), &network_service_client, + DeleteLoaderCallback(&delete_run_loop, &url_loader), + mojo::MakeRequest(&loader), 0, request, false, + client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS, ¶ms, + 0 /* request_id */, resource_scheduler_client(), nullptr, + nullptr /* network_usage_accumulator */); + + RunUntilIdle(); + ASSERT_TRUE(url_loader); + + EXPECT_EQ(0, network_service_client.on_certificate_requested_counter()); + + client()->RunUntilComplete(); + + EXPECT_EQ(1, network_service_client.on_certificate_requested_counter()); + EXPECT_EQ(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED, + client()->completion_status().error_code); +} + +TEST_F(URLLoaderTest, ClientAuthNoCertificate) { + net::EmbeddedTestServer test_server(net::EmbeddedTestServer::TYPE_HTTPS); + net::SSLServerConfig ssl_config; + ssl_config.client_cert_type = + net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; + test_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); + test_server.AddDefaultHandlers( + base::FilePath(FILE_PATH_LITERAL("services/test/data"))); + ASSERT_TRUE(test_server.Start()); + + MockNetworkServiceClient network_service_client; + network_service_client.set_certificate_response( + MockNetworkServiceClient::CertificateResponse::NULL_CERTIFICATE); + + ResourceRequest request = + CreateResourceRequest("GET", test_server.GetURL("/defaultresponse")); + base::RunLoop delete_run_loop; + mojom::URLLoaderPtr loader; + mojom::URLLoaderFactoryParams params; + params.process_id = kProcessId; + params.is_corb_enabled = false; + std::unique_ptr<URLLoader> url_loader = std::make_unique<URLLoader>( + context(), &network_service_client, + DeleteLoaderCallback(&delete_run_loop, &url_loader), + mojo::MakeRequest(&loader), 0, request, false, + client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS, ¶ms, + 0 /* request_id */, resource_scheduler_client(), nullptr, + nullptr /* network_usage_accumulator */); + + RunUntilIdle(); + ASSERT_TRUE(url_loader); + + EXPECT_EQ(0, network_service_client.on_certificate_requested_counter()); + + client()->RunUntilComplete(); + + EXPECT_EQ(1, network_service_client.on_certificate_requested_counter()); + EXPECT_EQ(net::ERR_BAD_SSL_CLIENT_AUTH_CERT, + client()->completion_status().error_code); +} + +TEST_F(URLLoaderTest, ClientAuthCertificateWithValidSignature) { + std::unique_ptr<net::FakeClientCertIdentity> identity = + net::FakeClientCertIdentity::CreateFromCertAndKeyFiles( + net::GetTestCertsDirectory(), "client_1.pem", "client_1.pk8"); + ASSERT_TRUE(identity); + scoped_refptr<TestSSLPrivateKey> private_key = + base::MakeRefCounted<TestSSLPrivateKey>(identity->ssl_private_key()); + TestSSLPrivateKey* private_key_ptr = private_key.get(); + + net::EmbeddedTestServer test_server(net::EmbeddedTestServer::TYPE_HTTPS); + net::SSLServerConfig ssl_config; + ssl_config.client_cert_type = + net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; + test_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); + test_server.AddDefaultHandlers( + base::FilePath(FILE_PATH_LITERAL("services/test/data"))); + ASSERT_TRUE(test_server.Start()); + + MockNetworkServiceClient network_service_client; + network_service_client.set_certificate_response( + MockNetworkServiceClient::CertificateResponse:: + VALID_CERTIFICATE_SIGNATURE); + network_service_client.set_private_key(std::move(private_key)); + scoped_refptr<net::X509Certificate> certificate = + test_server.GetCertificate(); + network_service_client.set_certificate(std::move(certificate)); + + ResourceRequest request = + CreateResourceRequest("GET", test_server.GetURL("/defaultresponse")); + base::RunLoop delete_run_loop; + mojom::URLLoaderPtr loader; + mojom::URLLoaderFactoryParams params; + params.process_id = kProcessId; + params.is_corb_enabled = false; + std::unique_ptr<URLLoader> url_loader = std::make_unique<URLLoader>( + context(), &network_service_client, + DeleteLoaderCallback(&delete_run_loop, &url_loader), + mojo::MakeRequest(&loader), 0, request, false, + client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS, ¶ms, + 0 /* request_id */, resource_scheduler_client(), nullptr, + nullptr /* network_usage_accumulator */); + + RunUntilIdle(); + ASSERT_TRUE(url_loader); + + EXPECT_EQ(0, network_service_client.on_certificate_requested_counter()); + EXPECT_EQ(0, private_key_ptr->sign_count()); + + client()->RunUntilComplete(); + + EXPECT_EQ(1, network_service_client.on_certificate_requested_counter()); + // The private key should have been used. + EXPECT_EQ(1, private_key_ptr->sign_count()); +} + +TEST_F(URLLoaderTest, ClientAuthCertificateWithInvalidSignature) { + std::unique_ptr<net::FakeClientCertIdentity> identity = + net::FakeClientCertIdentity::CreateFromCertAndKeyFiles( + net::GetTestCertsDirectory(), "client_1.pem", "client_1.pk8"); + ASSERT_TRUE(identity); + scoped_refptr<TestSSLPrivateKey> private_key = + base::MakeRefCounted<TestSSLPrivateKey>(identity->ssl_private_key()); + private_key->set_fail_signing(true); + TestSSLPrivateKey* private_key_ptr = private_key.get(); + + net::EmbeddedTestServer test_server(net::EmbeddedTestServer::TYPE_HTTPS); + net::SSLServerConfig ssl_config; + ssl_config.client_cert_type = + net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; + test_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); + test_server.AddDefaultHandlers( + base::FilePath(FILE_PATH_LITERAL("services/test/data"))); + ASSERT_TRUE(test_server.Start()); + + MockNetworkServiceClient network_service_client; + network_service_client.set_certificate_response( + MockNetworkServiceClient::CertificateResponse:: + VALID_CERTIFICATE_SIGNATURE); + network_service_client.set_private_key(std::move(private_key)); + scoped_refptr<net::X509Certificate> certificate = + test_server.GetCertificate(); + network_service_client.set_certificate(std::move(certificate)); + + ResourceRequest request = + CreateResourceRequest("GET", test_server.GetURL("/defaultresponse")); + base::RunLoop delete_run_loop; + mojom::URLLoaderPtr loader; + mojom::URLLoaderFactoryParams params; + params.process_id = kProcessId; + params.is_corb_enabled = false; + std::unique_ptr<URLLoader> url_loader = std::make_unique<URLLoader>( + context(), &network_service_client, + DeleteLoaderCallback(&delete_run_loop, &url_loader), + mojo::MakeRequest(&loader), 0, request, false, + client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS, ¶ms, + 0 /* request_id */, resource_scheduler_client(), nullptr, + nullptr /* network_usage_accumulator */); + + RunUntilIdle(); + ASSERT_TRUE(url_loader); + + EXPECT_EQ(0, network_service_client.on_certificate_requested_counter()); + EXPECT_EQ(0, private_key_ptr->sign_count()); + + client()->RunUntilComplete(); + + EXPECT_EQ(1, network_service_client.on_certificate_requested_counter()); + // The private key should have been used. + EXPECT_EQ(1, private_key_ptr->sign_count()); + EXPECT_EQ(net::ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED, + client()->completion_status().error_code); +} +#endif // !defined(OS_IOS) + } // namespace network
diff --git a/services/ws/public/cpp/gpu/context_provider_command_buffer.cc b/services/ws/public/cpp/gpu/context_provider_command_buffer.cc index 353b550..856e131 100644 --- a/services/ws/public/cpp/gpu/context_provider_command_buffer.cc +++ b/services/ws/public/cpp/gpu/context_provider_command_buffer.cc
@@ -396,6 +396,11 @@ return gr_context_->get(); } +gpu::SharedImageInterface* +ContextProviderCommandBuffer::SharedImageInterface() { + return command_buffer_->channel()->shared_image_interface(); +} + viz::ContextCacheController* ContextProviderCommandBuffer::CacheController() { CheckValidThreadOrLockAcquired(); return cache_controller_.get();
diff --git a/services/ws/public/cpp/gpu/context_provider_command_buffer.h b/services/ws/public/cpp/gpu/context_provider_command_buffer.h index 2f0df9e..7598338 100644 --- a/services/ws/public/cpp/gpu/context_provider_command_buffer.h +++ b/services/ws/public/cpp/gpu/context_provider_command_buffer.h
@@ -90,6 +90,7 @@ gpu::raster::RasterInterface* RasterInterface() override; gpu::ContextSupport* ContextSupport() override; class GrContext* GrContext() override; + gpu::SharedImageInterface* SharedImageInterface() override; viz::ContextCacheController* CacheController() override; base::Lock* GetLock() override; const gpu::Capabilities& ContextCapabilities() const override;
diff --git a/services/ws/window_tree.cc b/services/ws/window_tree.cc index 875f907..30e498d 100644 --- a/services/ws/window_tree.cc +++ b/services/ws/window_tree.cc
@@ -200,13 +200,13 @@ std::unique_ptr<ui::Event> event_to_send = PointerWatcher::CreateEventForClient(event); if (event.IsLocatedEvent()) { - aura::Window* client_root_window = GetClientRootWindowFor(window); - // The client_root_ may have been removed on shutdown. - if (client_root_window) { + ClientRoot* client_root = FindClientRootContaining(window); + // The |client_root| may have been removed on shutdown. + if (client_root) { gfx::PointF root_location = event_to_send->AsLocatedEvent()->root_location_f(); aura::Window::ConvertPointToTarget(window->GetRootWindow(), - client_root_window, &root_location); + client_root->window(), &root_location); event_to_send->AsLocatedEvent()->set_root_location_f(root_location); } } @@ -424,13 +424,13 @@ return window && FindClientRootWithRoot(window) != client_roots_.end(); } -aura::Window* WindowTree::GetClientRootWindowFor(aura::Window* window) { +ClientRoot* WindowTree::FindClientRootContaining(aura::Window* window) { if (!window) return nullptr; auto iter = FindClientRootWithRoot(window); if (iter != client_roots_.end()) - return iter->get()->window(); - return GetClientRootWindowFor(window->parent()); + return iter->get(); + return FindClientRootContaining(window->parent()); } WindowTree::ClientRoots::iterator WindowTree::FindClientRootWithRoot(
diff --git a/services/ws/window_tree.h b/services/ws/window_tree.h index 8ba6219..f1b750123 100644 --- a/services/ws/window_tree.h +++ b/services/ws/window_tree.h
@@ -200,9 +200,9 @@ bool IsClientCreatedWindow(aura::Window* window); bool IsClientRootWindow(aura::Window* window); - // Returns the window which is corresponded with the root window for the - // specified |window| in the client. - aura::Window* GetClientRootWindowFor(aura::Window* window); + // Returns the ClientRoot that |window| is parented to, null if |window| is + // not in a ClientRoot. + ClientRoot* FindClientRootContaining(aura::Window* window); ClientRoots::iterator FindClientRootWithRoot(aura::Window* window);
diff --git a/testing/buildbot/chromium.webrtc.fyi.experimental.json b/testing/buildbot/chromium.webrtc.fyi.experimental.json index 45348eb..41b03229 100644 --- a/testing/buildbot/chromium.webrtc.fyi.experimental.json +++ b/testing/buildbot/chromium.webrtc.fyi.experimental.json
@@ -5,72 +5,12 @@ "gtest_tests": [ { "args": [ - "--gtest_filter=WebRtcApprtcBrowserTest.*", - "--run-manual", - "--test-launcher-jobs=1" - ], - "name": "browser_tests_apprtc", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "browser_tests" - }, - { - "args": [ - "--test-launcher-filter-file=../../testing/buildbot/filters/webrtc_functional.browser_tests.filter", - "--run-manual", - "--test-launcher-jobs=1" - ], - "name": "browser_tests_functional", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "browser_tests" - }, - { - "args": [ "--gtest_filter=WebRtc*" ], "swarming": { "can_use_on_swarming_builders": true }, "test": "content_browsertests" - }, - { - "args": [ - "--gtest_filter=WebRtc*MANUAL*:-UsingRealWebcam*", - "--run-manual", - "--ui-test-action-max-timeout=120000" - ], - "name": "content_browsertests_stress", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_browsertests" - }, - { - "args": [ - "--test-launcher-filter-file=../../testing/buildbot/filters/webrtc.content_unittests.filter" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "jingle_unittests" - }, - { - "args": [ - "--gtest_filter=Webrtc*" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "remoting_unittests" } ] }, @@ -78,72 +18,12 @@ "gtest_tests": [ { "args": [ - "--gtest_filter=WebRtcApprtcBrowserTest.*", - "--run-manual", - "--test-launcher-jobs=1" - ], - "name": "browser_tests_apprtc", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "browser_tests" - }, - { - "args": [ - "--test-launcher-filter-file=../../testing/buildbot/filters/webrtc_functional.browser_tests.filter", - "--run-manual", - "--test-launcher-jobs=1" - ], - "name": "browser_tests_functional", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "browser_tests" - }, - { - "args": [ "--gtest_filter=WebRtc*" ], "swarming": { "can_use_on_swarming_builders": true }, "test": "content_browsertests" - }, - { - "args": [ - "--gtest_filter=WebRtc*MANUAL*:-UsingRealWebcam*", - "--run-manual", - "--ui-test-action-max-timeout=120000" - ], - "name": "content_browsertests_stress", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_browsertests" - }, - { - "args": [ - "--test-launcher-filter-file=../../testing/buildbot/filters/webrtc.content_unittests.filter" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "jingle_unittests" - }, - { - "args": [ - "--gtest_filter=Webrtc*" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "remoting_unittests" } ] },
diff --git a/testing/buildbot/filters/webui_polymer2_browser_tests.filter b/testing/buildbot/filters/webui_polymer2_browser_tests.filter index c10354b..3d7fa73 100644 --- a/testing/buildbot/filters/webui_polymer2_browser_tests.filter +++ b/testing/buildbot/filters/webui_polymer2_browser_tests.filter
@@ -94,11 +94,6 @@ -TabIndex/FilesAppBrowserTest.Test/tabindexSaveFileDialogDrive -TabIndex/FilesAppBrowserTest.Test/tabindexSaveFileDialogDrive_DriveFs -# These tests are flaky on the Chromium OS MSAN bot. -# See https://crbug.com/882606. --GalleryBrowserTest.* --GalleryBrowserTestInGuestMode.* - # Passing tests # # For practical reasons, we don't run all browser_tests with the WebUIPolymer2 @@ -251,6 +246,8 @@ FileManagerPathUtilConvertUrlTest.* FileManagerUITest.* FileTasksBrowserTest.* +GalleryBrowserTest.* +GalleryBrowserTestInGuestMode.* GalleryJsTest.* GPUSandboxStatusUITest.* ImageLoaderJsTest.*
diff --git a/testing/buildbot/generate_buildbot_json.py b/testing/buildbot/generate_buildbot_json.py index 93125ec..fab7e60 100755 --- a/testing/buildbot/generate_buildbot_json.py +++ b/testing/buildbot/generate_buildbot_json.py
@@ -841,7 +841,7 @@ 'win32-dbg', ] - def check_input_file_consistency(self): + def check_input_file_consistency(self, verbose=False): self.load_configuration_files() self.check_composition_test_suites() @@ -940,6 +940,58 @@ ' referenced in a waterfall, machine, or test suite.' % ( str(missing_mixins))) + self.check_input_files_sorting(verbose) + + def check_input_files_sorting(self, verbose=False): + bad_files = [] + # FIXME: Expand to other files. It's unclear if every other file should be + # similarly sorted. + for filename in ('swarming_mixins.pyl',): + parsed = ast.parse(self.read_file(self.pyl_file_path(filename))) + + def type_assert(itm, typ): # pragma: no cover + if not isinstance(itm, typ): + raise BBGenErr( + 'Invalid .pyl file %s. %s expected to be %s, is %s' % ( + filename, itm, typ, type(itm))) + + # Must be a module. + type_assert(parsed, ast.Module) + module = parsed.body + + # Only one expression in the module. + type_assert(module, list) + if len(module) != 1: # pragma: no cover + raise BBGenErr('Invalid .pyl file %s' % filename) + expr = module[0] + type_assert(expr, ast.Expr) + + # Value should be a dictionary. + value = expr.value + type_assert(value, ast.Dict) + + keys = [] + # The keys of this dict are ordered as ordered in the file; normal python + # dictionary keys are given an arbitrary order, but since we parsed the + # file itself, the order as given in the file is preserved. + for key in value.keys: + type_assert(key, ast.Str) + keys.append(key.s) + + if sorted(keys) != keys: + bad_files.append(filename) + if verbose: # pragma: no cover + for line in difflib.unified_diff( + sorted(keys), + keys): + print line + + if bad_files: + raise BBGenErr( + 'The following files have unsorted top level keys: %s' % ( + ', '.join(bad_files))) + + def check_output_file_consistency(self, verbose=False): self.load_configuration_files() # All waterfalls must have been written by this script already.
diff --git a/testing/buildbot/generate_buildbot_json_unittest.py b/testing/buildbot/generate_buildbot_json_unittest.py index 06b933a9..622f4f6 100755 --- a/testing/buildbot/generate_buildbot_json_unittest.py +++ b/testing/buildbot/generate_buildbot_json_unittest.py
@@ -209,6 +209,29 @@ ] """ +FOO_GTESTS_SORTING_MIXINS_WATERFALL = """\ +[ + { + 'swarming_mixins': ['a_mixin', 'b_mixin', 'c_mixin'], + 'name': 'chromium.test', + 'machines': { + 'Fake Tester': { + 'swarming': { + 'dimension_sets': [ + { + 'kvm': '1', + }, + ], + }, + 'test_suites': { + 'gtest_tests': 'foo_tests', + }, + }, + }, + }, +] +""" + FOO_LINUX_GTESTS_WATERFALL = """\ [ { @@ -1350,6 +1373,8 @@ } """ +# These mixins are invalid; if passed to check_input_file_consistency, they will +# fail. These are used for output file consistency checks. SWARMING_MIXINS = """\ { 'dimension_mixin': { @@ -1369,6 +1394,34 @@ } """ +SWARMING_MIXINS_UNSORTED = """\ +{ + 'b_mixin': { + 'b': 'b', + }, + 'a_mixin': { + 'a': 'a', + }, + 'c_mixin': { + 'c': 'c', + }, +} +""" + +SWARMING_MIXINS_SORTED = """\ +{ + 'a_mixin': { + 'a': 'a', + }, + 'b_mixin': { + 'b': 'b', + }, + 'c_mixin': { + 'c': 'c', + }, +} +""" + class UnitTest(unittest.TestCase): def test_base_generator(self): # Only needed for complete code coverage. @@ -1755,6 +1808,22 @@ with self.assertRaises(generate_buildbot_json.BBGenErr): fbb.check_output_file_consistency(verbose=True) + def test_swarming_mixins_must_be_sorted(self): + fbb = FakeBBGen(FOO_GTESTS_SORTING_MIXINS_WATERFALL, + FOO_TEST_SUITE, + EMPTY_PYL_FILE, + SWARMING_MIXINS_UNSORTED, + LUCI_MILO_CFG) + with self.assertRaises(generate_buildbot_json.BBGenErr): + fbb.check_input_file_consistency() + + fbb = FakeBBGen(FOO_GTESTS_SORTING_MIXINS_WATERFALL, + FOO_TEST_SUITE, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.check_input_file_consistency() + if __name__ == '__main__': unittest.main()
diff --git a/testing/buildbot/swarming_mixins.pyl b/testing/buildbot/swarming_mixins.pyl index 59e1a62..67d1ff6 100644 --- a/testing/buildbot/swarming_mixins.pyl +++ b/testing/buildbot/swarming_mixins.pyl
@@ -15,14 +15,14 @@ # already exists. { + 'arm_tester': { + 'dimensions': { + 'cpu': 'armv7l-32', + } + }, 'linux-trusty': { 'dimensions': { 'os': 'Ubuntu-14.04', } }, - 'arm_tester': { - 'dimensions': { - 'cpu': 'armv7l-32', - } - } }
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 36a76bf..1d2cd92 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -895,6 +895,12 @@ }, }, + 'webrtc_chromium_android_gtests': { + 'content_browsertests': { + 'args': ['--gtest_filter=WebRtc*'], + }, + }, + 'webrtc_chromium_gtests': { 'content_browsertests': { # Run all normal WebRTC content_browsertests. This is mostly so
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index f880daa..309836d 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -3470,12 +3470,12 @@ 'machines': { 'WebRTC Chromium FYI Android Tests (dbg) (K Nexus5)': { 'test_suites': { - 'gtest_tests': 'webrtc_chromium_gtests', + 'gtest_tests': 'webrtc_chromium_android_gtests', }, }, 'WebRTC Chromium FYI Android Tests (dbg) (M Nexus5X)': { 'test_suites': { - 'gtest_tests': 'webrtc_chromium_gtests', + 'gtest_tests': 'webrtc_chromium_android_gtests', }, }, 'WebRTC Chromium FYI Linux Tester': {
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index ce7e28a..d2e3293c 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -90,7 +90,7 @@ crbug.com/40634 external/wpt/css/css-text/white-space/trailing-space-before-br-001.html [ Pass ] crbug.com/591099 external/wpt/css/css-text/word-break/word-break-break-all-004.html [ Pass ] crbug.com/591099 external/wpt/css/css-transforms/transform-transformed-tr-percent-height-child.html [ Failure ] -crbug.com/591099 external/wpt/css/css-transitions/AnimationEffect-getComputedTiming.tentative.html [ Pass ] +crbug.com/591099 external/wpt/css/css-transitions/AnimationEffect-getComputedTiming.tentative.html [ Failure Pass ] crbug.com/591099 external/wpt/css/css-transitions/properties-value-003.html [ Pass ] crbug.com/591099 external/wpt/css/css-transitions/properties-value-implicit-001.html [ Pass ] crbug.com/591099 external/wpt/css/css-ui/text-overflow-010.html [ Pass ] @@ -275,7 +275,7 @@ crbug.com/591099 external/wpt/picture-in-picture/request-picture-in-picture-twice.html [ Pass ] crbug.com/591099 external/wpt/pointerevents/pointerevent_click_during_capture-manual.html [ Crash Timeout ] crbug.com/591099 external/wpt/quirks/line-height-calculation.html [ Failure ] -crbug.com/591099 external/wpt/requestidlecallback/callback-iframe.html [ Pass ] +crbug.com/591099 external/wpt/requestidlecallback/callback-iframe.html [ Pass Timeout ] crbug.com/591099 external/wpt/requestidlecallback/callback-timeout-when-busy.html [ Timeout ] crbug.com/591099 external/wpt/requestidlecallback/callback-timeout.html [ Timeout ] crbug.com/591099 external/wpt/service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html [ Failure ] @@ -362,8 +362,9 @@ crbug.com/591099 fast/events/touch/compositor-touch-hit-rects.html [ Failure ] crbug.com/591099 fast/events/wheel/mainthread-touchpad-fling-latching.html [ Pass ] crbug.com/591099 fast/events/wheel/wheel-scroll-latching-on-scrollbar.html [ Pass ] +crbug.com/591099 fast/forms/placeholder-position.html [ Failure ] crbug.com/591099 fast/forms/select/menulist-appearance-rtl.html [ Failure ] -crbug.com/591099 fast/frames/crash-frameset-CSS-content-property.html [ Pass ] +crbug.com/591099 fast/frames/crash-frameset-CSS-content-property.html [ Crash Pass ] crbug.com/835484 fast/inline/continuation-outlines-with-layers.html [ Failure ] crbug.com/835484 fast/inline/continuation-outlines.html [ Failure ] crbug.com/835484 fast/inline/inline-focus-ring-under-absolute-enclosing-relative-div.html [ Failure ] @@ -373,7 +374,7 @@ crbug.com/591099 fast/overflow/overflow-update-transform.html [ Failure ] crbug.com/591099 fast/overflow/recompute-overflow-of-layout-root-container.html [ Failure ] crbug.com/591099 fast/replaced/table-replaced-element.html [ Failure ] -crbug.com/591099 fast/scrolling/scrollbar-tickmarks-hittest.html [ Failure ] +crbug.com/591099 fast/scrolling/scrollbar-tickmarks-hittest.html [ Failure Pass ] crbug.com/591099 fast/sub-pixel/sub-pixel-border-2.html [ Failure ] crbug.com/591099 fast/table/border-collapsing/004-vertical.html [ Failure ] crbug.com/591099 fast/table/border-collapsing/composited-cell-collapsed-border.html [ Failure ] @@ -416,18 +417,17 @@ crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-appcache.https.html [ Crash Failure ] crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-csp-appcache.https.html [ Crash Failure Pass ] crbug.com/591099 http/tests/security/setDomainRelaxationForbiddenForURLScheme.html [ Crash ] -crbug.com/591099 idle-callback/test-runner-run-idle-tasks.html [ Pass ] +crbug.com/591099 idle-callback/test-runner-run-idle-tasks.html [ Crash Pass ] crbug.com/591099 images/color-profile-image-filter-all.html [ Failure ] crbug.com/591099 images/rendering-broken-block-flow-images.html [ Failure ] crbug.com/591099 images/rendering-broken-images.html [ Failure ] crbug.com/714962 inspector-protocol/css/css-get-platform-fonts.js [ Failure ] crbug.com/591099 inspector-protocol/dom-snapshot/dom-snapshot-getSnapshot-pseudo-element.js [ Failure ] -crbug.com/591099 inspector-protocol/dom-snapshot/dom-snapshot-getSnapshot-scroll-offset.js [ Failure ] -crbug.com/591099 inspector-protocol/dom-snapshot/dom-snapshot-getSnapshot-viewport.js [ Failure ] crbug.com/591099 inspector-protocol/dom-snapshot/dom-snapshot-getSnapshot.js [ Failure ] crbug.com/714962 inspector-protocol/layout-fonts/languages-emoji-rare-glyphs.js [ Failure ] crbug.com/591099 inspector-protocol/timeline/page-frames.js [ Failure ] crbug.com/591099 intersection-observer/v2/text-shadow.html [ Failure ] +crbug.com/591099 media/video-layer-crash.html [ Failure ] crbug.com/591099 paint/float/float-under-inline-self-painting-change.html [ Failure ] crbug.com/835484 paint/inline/focus-ring-under-absolute-with-relative-continuation.html [ Failure ] crbug.com/591099 paint/invalidation/clip/control-clip.html [ Failure ] @@ -439,7 +439,6 @@ crbug.com/591099 paint/invalidation/flexbox/justify-self-change-keeping-geometry.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/repaint-on-margin-change.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/scrollbars-changed.html [ Failure ] -crbug.com/591099 paint/invalidation/forms/details-marker-color-change.html [ Failure Pass ] crbug.com/591099 paint/invalidation/line-flow-with-floats-1.html [ Failure ] crbug.com/591099 paint/invalidation/line-flow-with-floats-10.html [ Failure ] crbug.com/591099 paint/invalidation/line-flow-with-floats-3.html [ Failure ] @@ -476,6 +475,7 @@ crbug.com/591099 svg/filters/feTurbulence-bad-seeds.html [ Failure ] crbug.com/591099 svg/hixie/error/013.xml [ Failure ] crbug.com/591099 svg/in-html/sizing/svg-inline.html [ Failure ] +crbug.com/591099 svg/transforms/svg-css-transforms.xhtml [ Failure ] crbug.com/591099 svg/transforms/text-with-pattern-inside-transformed-html.xhtml [ Failure ] crbug.com/591099 svg/zoom/page/zoom-img-preserveAspectRatio-support-1.html [ Failure ] crbug.com/591099 svg/zoom/page/zoom-svg-float-border-padding.xml [ Failure ] @@ -489,7 +489,15 @@ crbug.com/591099 tables/mozilla/bugs/bug50695-2.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug55527.html [ Failure ] crbug.com/591099 tables/mozilla_expected_failures/bugs/bug3166-16.html [ Failure ] -crbug.com/591099 virtual/android/ [ Skip ] +crbug.com/591099 transforms/3d/hit-testing/backface-no-transform-hit-test.html [ Failure ] +crbug.com/591099 transforms/3d/point-mapping/3d-point-mapping-deep.html [ Failure ] +crbug.com/591099 transforms/3d/point-mapping/3d-point-mapping-origins.html [ Failure ] +crbug.com/591099 transforms/3d/point-mapping/3d-point-mapping-overlapping.html [ Failure ] +crbug.com/591099 transforms/3d/point-mapping/3d-point-mapping-preserve-3d.html [ Failure ] +crbug.com/591099 transforms/3d/point-mapping/3d-point-mapping.html [ Failure ] +crbug.com/591099 transforms/svg-vs-css.xhtml [ Failure ] +crbug.com/870008 virtual/android/rootscroller/position-fixed-in-unscrollable-document-iframe.html [ Failure ] +crbug.com/870008 virtual/android/rootscroller/position-fixed-in-unscrollable-document.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/ [ Skip ] crbug.com/591099 virtual/feature-policy-vibrate/ [ Skip ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-filter-all.html [ Failure ] @@ -537,4 +545,5 @@ crbug.com/591099 virtual/user-activation-v2/fast/events/mouse-cursor.html [ Failure ] crbug.com/591099 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] crbug.com/591099 virtual/video-surface-layer/media/video-aspect-ratio.html [ Failure ] +crbug.com/591099 virtual/video-surface-layer/media/video-layer-crash.html [ Failure ] crbug.com/591099 virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/RTCDTMFSender-ontonechange.https.html [ Pass ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees index 65237479..b7173759 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees
@@ -217,5 +217,3 @@ crbug.com/884239 virtual/threaded/fast/animationworklet/worklet-animation-local-time-undefined.html [ Failure ] crbug.com/884240 images/cross-fade-invalidation.html [ Pass Failure ] - -crbug.com/884846 virtual/threaded/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 index bec7455..5a9c372 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2
@@ -1072,9 +1072,6 @@ crbug.com/706066 paint/invalidation/scale-page-shrink.html [ Crash ] crbug.com/706066 paint/invalidation/compositing/page-scale-repaint.html [ Crash ] crbug.com/706066 paint/invalidation/position/relayout-fixed-position-after-scale.html [ Crash ] -crbug.com/706066 virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-div-scaled.html [ Crash Failure ] -crbug.com/706066 virtual/threaded/fast/events/touch/touch-scaled-scrolled.html [ Crash ] -crbug.com/706066 virtual/threaded/fast/events/touch/page-scaled-touch-gesture-click.html [ Crash ] crbug.com/719721 virtual/threaded/animations/composited-animation-style-update.html [ Pass Failure ] @@ -1423,47 +1420,3 @@ Bug(none) fast/events/touch/compositor-touch-hit-rects-svg-root.html [ Failure ] Bug(none) fast/events/touch/compositor-touch-hit-rects-table.html [ Failure ] Bug(none) virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-table.html [ Failure ] - -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-animation.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-continuation.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-global.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-iframes.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-img-element.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-list-no-translate.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-many.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll-overflow-with-handler.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-scroll.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-squashing.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-svg-container.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-svg-foreign-object.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-svg-image.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-svg-root.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-svg-text.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-svg.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-table.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-transform-changed-nolayout.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-trigger-commit.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/compositor-touch-hit-rects-with-negative-child.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/touch-action-range-input.html [ Failure Timeout ] -Bug(none) virtual/threaded/fast/events/touch/touch-handler-assert-input-range.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/touch-rect-assert-first-layer-special.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/touch-rect-crash-on-unpromote-layer.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/gesture/gesture-scroll-by-page.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/gesture/gesture-scrollbar-textarea.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-div-zoomed.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-input-field.html [ Failure ] -Bug(none) virtual/threaded/fast/events/wheel/wheel-in-scrollbar.html [ Failure ] -Bug(none) virtual/threaded/fast/events/wheel/wheel-scroll-latching-on-scrollbar.html [ Failure ] -Bug(none) virtual/threaded/fast/events/wheel/wheelevent-in-horizontal-scrollbar-in-rtl.html [ Failure ] -Bug(none) virtual/threaded/fast/events/wheel/wheelevent-in-vertical-scrollbar-in-rtl.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-iframe.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/gesture/gesture-scrollbar.html [ Failure Timeout ] -Bug(none) virtual/threaded/fast/events/touch/gesture/gesture-tap-frame-scrollbar.html [ Failure ] -Bug(none) virtual/threaded/fast/events/touch/touch-action-range-input-csp.html [ Timeout Pass ] -Bug(none) virtual/threaded/fast/events/touch/touch-fractional-coordinates.html [ Crash Pass ] -Bug(none) virtual/threaded/fast/events/touch/gesture/context-menu-on-two-finger-tap-iframe.html [ Crash Pass ] -Bug(none) virtual/threaded/fast/events/wheel/wheelevent-document-createevent.html [ Crash Pass ] \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index deddc1ea..14e2252 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -145,37 +145,26 @@ crbug.com/857490 virtual/mouseevent_fractional/fast/events/touch/gesture/touch-gesture-fling-with-page-scale.html [ Skip ] crbug.com/857490 virtual/mouseevent_fractional/fast/events/wheel/mainthread-touchpad-fling-latching.html [ Skip ] crbug.com/857490 virtual/mouseevent_fractional/fast/events/wheel/wheel-fling-cancel.html [ Skip ] +crbug.com/857490 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-list-translate.html [ Skip ] +crbug.com/857490 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects.html [ Skip ] crbug.com/857490 virtual/scroll_customization/fast/events/touch/gesture/pad-gesture-cancel.html [ Skip ] crbug.com/857490 virtual/scroll_customization/fast/events/touch/gesture/pad-gesture-fling.html [ Skip ] crbug.com/857490 virtual/scroll_customization/fast/events/touch/gesture/touch-gesture-fling-with-page-scale.html [ Skip ] crbug.com/857490 virtual/scroll_customization/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html [ Skip ] +crbug.com/857490 virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects-list-translate.html [ Skip ] +crbug.com/857490 virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects.html [ Skip ] crbug.com/857490 virtual/user-activation-v2/fast/events/touch/gesture/pad-gesture-cancel.html [ Skip ] crbug.com/857490 virtual/user-activation-v2/fast/events/touch/gesture/pad-gesture-fling.html [ Skip ] crbug.com/857490 virtual/user-activation-v2/fast/events/touch/gesture/touch-gesture-fling-with-page-scale.html [ Skip ] crbug.com/857490 virtual/user-activation-v2/fast/events/wheel/mainthread-touchpad-fling-latching.html [ Skip ] crbug.com/857490 virtual/user-activation-v2/fast/events/wheel/wheel-fling-cancel.html [ Skip ] +crbug.com/857490 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-list-translate.html [ Skip ] +crbug.com/857490 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects.html [ Skip ] crbug.com/857490 virtual/paint-touchaction-rects/fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ] crbug.com/857490 virtual/paint-touchaction-rects/fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ] crbug.com/857490 virtual/paint-touchaction-rects/fast/events/touch/gesture/pad-gesture-cancel.html [ Skip ] crbug.com/857490 virtual/paint-touchaction-rects/fast/events/touch/gesture/pad-gesture-fling.html [ Skip ] crbug.com/857490 virtual/paint-touchaction-rects/fast/events/touch/gesture/touch-gesture-fling-with-page-scale.html [ Skip ] -crbug.com/857490 virtual/threaded/fast/events/touch/gesture/pad-gesture-cancel.html [ Skip ] -crbug.com/857490 virtual/threaded/fast/events/touch/gesture/pad-gesture-fling.html [ Skip ] -crbug.com/857490 virtual/threaded/fast/events/touch/gesture/touch-gesture-fling-with-page-scale.html [ Skip ] -crbug.com/857490 virtual/threaded/fast/events/wheel/mainthread-touchpad-fling-latching.html [ Skip ] -crbug.com/857490 virtual/threaded/fast/events/wheel/wheel-fling-cancel.html [ Skip ] - -crbug.com/884312 fast/events/touch/multi-touch-user-gesture.html [ Pass Failure ] -crbug.com/884312 virtual/threaded/fast/events/touch/multi-touch-user-gesture.html [ Pass Failure ] -crbug.com/884312 virtual/user-activation-v2/fast/events/touch/multi-touch-user-gesture.html [ Pass Failure ] - -# The test is still using eventSender and that's why its threaded version fails: -crbug.com/884332 virtual/threaded/fast/events/touch/gesture/gesture-tap-active-state-hidden-iframe.html [ Skip ] -crbug.com/884332 virtual/threaded/fast/events/touch/gesture/gesture-tap-frame-removed.html [ Skip ] -crbug.com/884332 virtual/threaded/fast/events/touch/scroll-without-mouse-lacks-mousemove-events.html [ Skip ] -crbug.com/884332 virtual/threaded/fast/events/touch/gesture/gesture-tap-active-state.html [ Skip ] -crbug.com/884332 virtual/threaded/fast/events/touch/gesture/focus-selectionchange-on-tap.html [ Skip ] -crbug.com/884332 virtual/threaded/fast/events/touch/gesture/gesture-tap-scrolled.html [ Skip ] # Sheriff 2018/05/25 crbug.com/846747 http/tests/navigation/navigation-interrupted-by-fragment.html [ Pass Timeout ] @@ -344,6 +333,76 @@ crbug.com/863454 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-multicol-003.html [ Failure ] crbug.com/882333 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-inline-block-001.html [ Failure ] +# [css-align] + +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003.html [ Failure ] +crbug.com/722287 crbug.com/886585 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004.html [ Failure ] +crbug.com/599828 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001.html [ Failure ] +crbug.com/722287 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002.html [ Failure ] +crbug.com/886592 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003.html [ Failure ] +crbug.com/885175 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004.html [ Failure ] + # ====== Layout team owned tests to here ====== # ====== LayoutNG-only failures from here ====== @@ -1884,14 +1943,6 @@ crbug.com/876305 fast/events/touch/compositor-touch-hit-rects-list-translate.html [ Failure ] crbug.com/876305 fast/events/touch/compositor-touch-hit-rects.html [ Failure ] -crbug.com/876305 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-list-translate.html [ Failure ] -crbug.com/876305 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] -crbug.com/876305 virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects-list-translate.html [ Failure ] -crbug.com/876305 virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] -crbug.com/876305 virtual/threaded/fast/events/touch/compositor-touch-hit-rects-list-translate.html [ Failure ] -crbug.com/876305 virtual/threaded/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] -crbug.com/876305 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-list-translate.html [ Failure ] -crbug.com/876305 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] # TODO(ojan): These tests aren't flaky. See crbug.com/517144. # Release trybots run asserts, but the main waterfall ones don't. So, even @@ -1963,10 +2014,6 @@ crbug.com/404597 [ Mac ] fast/css3-text/css3-text-justify/text-justify-crash.html [ Failure ] crbug.com/404597 fast/forms/long-text-in-input.html [ Skip ] -# Web Components related tests (Shadow DOM, Custom Elements) failures. -crbug.com/392771 external/wpt/shadow-dom/untriaged/styles/test-003.html [ Failure ] -crbug.com/869308 shadow-dom/imperative-api.html [ Failure ] - crbug.com/552494 virtual/prefer_compositing_to_lcd_text/scrollbars/overflow-scrollbar-combinations.html [ Pass Failure ] crbug.com/652964 [ Linux Win ] fast/text/hyphens/hyphen-min-preferred-width-mock.html [ Skip ] @@ -2404,32 +2451,6 @@ crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/touch-gesture-scroll-page-past-extent.html [ Skip ] crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ] crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/gesture-scroll-by-page.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/gesture-scroll.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/gesture-scrollbar.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-noscroll-body-propagated.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-noscroll-body-xhidden.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-noscroll-body-yhidden.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-noscroll-body.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-noscroll-div.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-noscroll-iframe.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-div-past-extent-diagonally.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-div-past-extent.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-div-scaled.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-div-twice-past-extent.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-div-zoomed.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-div.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-iframe-editable.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-iframe-past-extent.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-iframe.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-input-field.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-listbox.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-page-past-extent.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ] -crbug.com/613672 [ Mac ] virtual/threaded/fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ] crbug.com/802067 [ Mac ] external/wpt/pointerlock/movementX_Y_basic-manual.html [ Failure ] crbug.com/802067 [ Mac ] external/wpt/pointerevents/pointerlock/pointerevent_movementxy-manual.html [ Failure ] @@ -2816,6 +2837,8 @@ crbug.com/875249 external/wpt/infrastructure/testdriver/bless.html [ Timeout Pass ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins.html [ Failure ] +crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering.html [ Failure ] crbug.com/626703 [ Mac ] external/wpt/css/css-text/hyphens/hyphens-auto-001.html [ Failure ] crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-tall.html [ Failure ] crbug.com/626703 external/wpt/speech-api/SpeechSynthesis-speak-events.html [ Timeout ] @@ -2841,7 +2864,6 @@ crbug.com/626703 virtual/layout_ng/external/wpt/css/CSS2/floats/float-nowrap-7.html [ Failure ] crbug.com/626703 virtual/layout_ng/external/wpt/css/CSS2/floats/float-nowrap-9.html [ Failure ] crbug.com/626703 external/wpt/css/CSS2/floats/float-nowrap-7.html [ Failure ] -crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item.html [ Failure ] crbug.com/626703 [ Retina ] external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-003v.html [ Failure ] crbug.com/626703 [ Mac10.10 Mac10.12 ] external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-003v.html [ Failure ] crbug.com/626703 [ Mac ] external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-vertical.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/VirtualTestSuites b/third_party/WebKit/LayoutTests/VirtualTestSuites index ec906693..6d74e3ce 100644 --- a/third_party/WebKit/LayoutTests/VirtualTestSuites +++ b/third_party/WebKit/LayoutTests/VirtualTestSuites
@@ -89,16 +89,6 @@ }, { "prefix": "threaded", - "base": "fast/events/touch", - "args": ["--enable-threaded-compositing"] - }, - { - "prefix": "threaded", - "base": "fast/events/wheel", - "args": ["--enable-threaded-compositing"] - }, - { - "prefix": "threaded", "base": "fast/events/pointerevents/pinch", "args": ["--enable-threaded-compositing"] },
diff --git a/third_party/WebKit/LayoutTests/W3CImportExpectations b/third_party/WebKit/LayoutTests/W3CImportExpectations index 9c322e6..4bb1b91 100644 --- a/third_party/WebKit/LayoutTests/W3CImportExpectations +++ b/third_party/WebKit/LayoutTests/W3CImportExpectations
@@ -94,7 +94,6 @@ external/wpt/css/filter-effects [ Skip ] external/wpt/css/tools [ Skip ] external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/README [ Skip ] -external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3 [ Skip ] external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/background [ Skip ] external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/check-for-references.sh [ Skip ] external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/conditional3 [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html b/third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html index 0f9bbdd2..4598373 100644 --- a/third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html +++ b/third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html
@@ -97,31 +97,18 @@ title: 'Context click at boundary of misspelled word.', callback: sample => test(() => { const container = sample.document.querySelector('div'); - const shouldSelect = isMac(navigator.platform); - if (shouldSelect) { - // On Mac, right-clicking immediately before a word will select it. - assertContextClickSelection( + assertContextClickSelection( container, 0, 'wellcome', 'Context clicking immediately before "wellcome" selects it'); - // De-select "wellcome"; otherwise, context-clicking immediately after "wellcome" will - // not change the selection (since it would select a space and not another word) - container.ownerDocument.getSelection().removeAllRanges(); + // De-select "wellcome" to ensure that context-clicking immediately after + // "wellcome" will select it again. + container.ownerDocument.getSelection().removeAllRanges(); - // On Mac, right-clicking immediately after a word will select the space after it. - assertContextClickSelection( - container, 8, ' ', - 'Context clicking immediately after "wellcome" selects the space after it'); - return; - } - + // Right-clicking immediately after a word will select the whole word. assertContextClickSelection( - container, 0, '', - 'Context clicking immediately before "wellcome" does not select it'); - - assertContextClickSelection( - container, 8, '', - 'Context clicking immediately after "wellcome" does not select it'); + container, 8, 'wellcome', + 'Context clicking immediately after "wellcome" selects it'); }, 'Context clicking immediately before or after misspelled word in editable DIV does not select it.', {sample: sample, blockHeldTest: true})
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json index cfaf1db9..8c972d7f 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json
@@ -5563,6 +5563,12 @@ {} ] ], + "pointerevents/extension/pointerevent_getCoalescedEvents_when_pointerlocked-manual.html": [ + [ + "/pointerevents/extension/pointerevent_getCoalescedEvents_when_pointerlocked-manual.html", + {} + ] + ], "pointerevents/extension/pointerevent_pointerrawmove-manual.html": [ [ "/pointerevents/extension/pointerevent_pointerrawmove-manual.html", @@ -5971,6 +5977,18 @@ {} ] ], + "pointerevents/pointerlock/pointerevent_pointermove_in_pointerlock-manual.html": [ + [ + "/pointerevents/pointerlock/pointerevent_pointermove_in_pointerlock-manual.html", + {} + ] + ], + "pointerevents/pointerlock/pointerevent_pointermove_on_chorded_mouse_button_when_locked-manual.html": [ + [ + "/pointerevents/pointerlock/pointerevent_pointermove_on_chorded_mouse_button_when_locked-manual.html", + {} + ] + ], "pointerlock/mouse_buttons_back_forward-manual.html": [ [ "/pointerlock/mouse_buttons_back_forward-manual.html", @@ -47947,6 +47965,18 @@ {} ] ], + "css/css-layout-api/constraints-fixed-block-size-percentage-quirks-mode.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-percentage-quirks-mode.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-layout-api/constraints-fixed-block-size-percentage-vrl.https.html": [ [ "/css/css-layout-api/constraints-fixed-block-size-percentage-vrl.https.html", @@ -88247,6 +88277,858 @@ {} ] ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004.html": [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004.html", + [ + [ + "/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004-ref.html", + "==" + ] + ], + {} + ] + ], "css/vendor-imports/mozilla/mozilla-central-reftests/break3/moz-block-fragmentation-001.html": [ [ "/css/vendor-imports/mozilla/mozilla-central-reftests/break3/moz-block-fragmentation-001.html", @@ -97667,6 +98549,18 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins.html": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins.html", + [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins-ref.html", + "==" + ] + ], + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering.html", @@ -97679,6 +98573,18 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering.html": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering.html", + [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering-ref.html", + "==" + ] + ], + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-float.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-float.html", @@ -128833,11 +129739,6 @@ {} ] ], - "css/css-grid/abspos/absolute-positioning-grid-container-parent-001-expected.txt": [ - [ - {} - ] - ], "css/css-grid/abspos/grid-paint-positioned-children-001-ref.html": [ [ {} @@ -138598,6 +139499,11 @@ {} ] ], + "css/css-values/calc-integer-expected.txt": [ + [ + {} + ] + ], "css/css-values/calc-rem-lang-ref.html": [ [ {} @@ -143018,6 +143924,371 @@ {} ] ], + "css/vendor-imports/mozilla/mozilla-central-reftests/OWNERS": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004-ref.html": [ + [ + {} + ] + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/support/colors-8x16.png": [ + [ + {} + ] + ], "css/vendor-imports/mozilla/mozilla-central-reftests/break3/moz-block-fragmentation-001-ref.html": [ [ {} @@ -157278,6 +158549,11 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size-expected.txt": [ + [ + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-shadow-dom.html": [ [ {} @@ -157293,6 +158569,11 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self-expected.txt": [ + [ + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align-expected.txt": [ [ {} @@ -157303,6 +158584,11 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins-ref.html": [ + [ + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-expected.txt": [ [ {} @@ -157313,6 +158599,11 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering-ref.html": [ + [ + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-dynamic-update.html": [ [ {} @@ -165868,6 +167159,11 @@ {} ] ], + "pointerevents/pointerlock/resources/pointerevent_pointermove_in_pointerlock-iframe.html": [ + [ + {} + ] + ], "pointerevents/resources/pointerevent_attributes_hoverable_pointers-iframe.html": [ [ {} @@ -188883,12 +190179,6 @@ {} ] ], - "background-fetch/dangling-markup.https.window.js": [ - [ - "/background-fetch/dangling-markup.https.window.html", - {} - ] - ], "background-fetch/fetch.https.window.js": [ [ "/background-fetch/fetch.https.window.html", @@ -194131,6 +195421,12 @@ {} ] ], + "css/css-align/inheritance.html": [ + [ + "/css/css-align/inheritance.html", + {} + ] + ], "css/css-align/self-alignment/parse-align-self-001.html": [ [ "/css/css-align/self-alignment/parse-align-self-001.html", @@ -197335,6 +198631,12 @@ {} ] ], + "css/css-grid/inheritance.html": [ + [ + "/css/css-grid/inheritance.html", + {} + ] + ], "css/css-grid/layout-algorithm/grid-content-distribution-must-account-for-track-sizing-001.html": [ [ "/css/css-grid/layout-algorithm/grid-content-distribution-must-account-for-track-sizing-001.html", @@ -199393,6 +200695,12 @@ {} ] ], + "css/css-text-decor/inheritance.html": [ + [ + "/css/css-text-decor/inheritance.html", + {} + ] + ], "css/css-text-decor/text-decoration-serialization.tentative.html": [ [ "/css/css-text-decor/text-decoration-serialization.tentative.html", @@ -203175,6 +204483,12 @@ {} ] ], + "css/css-values/calc-integer.html": [ + [ + "/css/css-values/calc-integer.html", + {} + ] + ], "css/css-values/calc-rounding-001.html": [ [ "/css/css-values/calc-rounding-001.html", @@ -204975,6 +206289,12 @@ {} ] ], + "css/motion/offset-path-serialization.html": [ + [ + "/css/motion/offset-path-serialization.html", + {} + ] + ], "css/motion/offset-supports-calc.html": [ [ "/css/motion/offset-supports-calc.html", @@ -222781,12 +224101,24 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size.html": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size.html", + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-padding.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-padding.html", {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self.html": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self.html", + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align.html", @@ -222829,6 +224161,12 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-margin-inline.html": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-margin-inline.html", + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display.html", @@ -258561,6 +259899,12 @@ {} ] ], + "shadow-dom/event-dispatch-order.tentative.html": [ + [ + "/shadow-dom/event-dispatch-order.tentative.html", + {} + ] + ], "shadow-dom/event-inside-shadow-tree.html": [ [ "/shadow-dom/event-inside-shadow-tree.html", @@ -260671,6 +262015,12 @@ {} ] ], + "svg/path/property/serialization.svg": [ + [ + "/svg/path/property/serialization.svg", + {} + ] + ], "svg/scripted/text-attrs-dxdy-have-length.svg": [ [ "/svg/scripted/text-attrs-dxdy-have-length.svg", @@ -286294,16 +287644,12 @@ "0b5b1cb5e94d3f27bebbb5a462bf1e823dfc57b4", "testharness" ], - "background-fetch/dangling-markup.https.window.js": [ - "764257d7d1a8eecfba6735647637055b21dcb94b", - "testharness" - ], "background-fetch/fetch.https.window-expected.txt": [ "a0fa36962d1606d5964f686b2fc8be11dbd29099", "support" ], "background-fetch/fetch.https.window.js": [ - "70dacd717a0aac009c708c1157dcfe5149a6a069", + "95990e09faa174ba7f66b8367f926b46d7727f73", "testharness" ], "background-fetch/get-ids.https.window.js": [ @@ -307386,6 +308732,10 @@ "71b971d3a8a18cc7cd9710ac00ffe10e4f4111e4", "testharness" ], + "css/css-align/inheritance.html": [ + "7e2fa130be24214fa8c21f58d0f88a744beb6b79", + "testharness" + ], "css/css-align/reference/ttwf-reftest-alignContent-ref.html": [ "a94c1d5e9e85dfe0aec20145b25e55dc5b1a673d", "support" @@ -324746,10 +326096,6 @@ "e456af8ce0a30b430ab2696c892c6fde8884007c", "testharness" ], - "css/css-grid/abspos/absolute-positioning-grid-container-parent-001-expected.txt": [ - "9b3a658349f94acd6157c2734c08ccaaee554aed", - "support" - ], "css/css-grid/abspos/absolute-positioning-grid-container-parent-001.html": [ "a7a38ad0a0ab8c8fa13b7fac0a75268e1a026cbb", "testharness" @@ -326850,6 +328196,10 @@ "2e90b460194568752c09ff94fd834deb08606fe4", "reftest" ], + "css/css-grid/inheritance.html": [ + "eee86f70300d4280531235c813589dc3c399c58c", + "testharness" + ], "css/css-grid/layout-algorithm/grid-content-distribution-must-account-for-track-sizing-001.html": [ "c1ae11feee9b84fd7ea123dc396a7a95e70e4733", "testharness" @@ -327447,7 +328797,7 @@ "support" ], "css/css-inline/inheritance-expected.txt": [ - "80dba45ac220f8472106f0e7ce96fe35061937b7", + "18b9e4e22acdbbdc5040b1c7f1838f645f9eecfb", "support" ], "css/css-inline/inheritance.html": [ @@ -327634,6 +328984,10 @@ "94a20387442c36b5041e40194aa7ceda405a3274", "reftest" ], + "css/css-layout-api/constraints-fixed-block-size-percentage-quirks-mode.https.html": [ + "9bd9044991cdde7c113f8fdbd08a2048a77746f9", + "reftest" + ], "css/css-layout-api/constraints-fixed-block-size-percentage-vrl.https.html": [ "8c7a8c5d3ea11ac3a5ac6e4269340baa10e266a5", "reftest" @@ -334202,6 +335556,10 @@ "801a0f4a54b73d5dbf9db773c6c1281e76c76c77", "support" ], + "css/css-text-decor/inheritance.html": [ + "17486f1f193d04fadc1ed000121f62cae0b3d530", + "testharness" + ], "css/css-text-decor/line-through-vertical.html": [ "633c5c00392711f1fe1911a07f9cf53c3cd702e9", "reftest" @@ -349082,6 +350440,14 @@ "4b7d7c87034184a38a708dcc4c6fe19b47b12220", "reftest" ], + "css/css-values/calc-integer-expected.txt": [ + "3c23adfbed9bd0a59d276b089768a7f087a4fdea", + "support" + ], + "css/css-values/calc-integer.html": [ + "821dac4048961cdff3eae329b02566310f75eb1f", + "testharness" + ], "css/css-values/calc-invalid-range-clamping.html": [ "a88416a2c2da6532084dc77ded1d3d5ac15e120e", "reftest" @@ -357330,6 +358696,10 @@ "6c39e7b8f4cfafe05c07d166eb65570432912b7a", "reftest" ], + "css/motion/offset-path-serialization.html": [ + "1c000919518e4052d1c9546580c9b9cca89883c7", + "testharness" + ], "css/motion/offset-path-string-001.html": [ "79d957d82b8e3c603ed16598f461a805c90681dd", "reftest" @@ -357379,7 +358749,7 @@ "testharness" ], "css/motion/parsing/offset-parsing-valid.html": [ - "b93091b2088987cb402c364e0d3794d847522a16", + "3fe8a5b20d805ae3d330b8c653593b6b0c0e0d9e", "testharness" ], "css/motion/parsing/offset-path-parsing-invalid.html": [ @@ -357387,11 +358757,11 @@ "testharness" ], "css/motion/parsing/offset-path-parsing-valid-expected.txt": [ - "8a2d22a747ec0351b41c3f0f8ccd5decd70af1d0", + "ab96dc8603dae2775747263cf63a57b19a47fcf8", "support" ], "css/motion/parsing/offset-path-parsing-valid.html": [ - "bda82928726dc8c3a30207f9871a4883e2db5376", + "0ed360f6e369e5b53ae4ae0b1b535a7ff8e31ca9", "testharness" ], "css/motion/parsing/offset-position-parsing-invalid.html": [ @@ -359403,7 +360773,7 @@ "support" ], "css/support/inheritance-testcommon.js": [ - "50bf4c3ae2ba9490fc30af46849820c81b72b774", + "1a4d2fee89144e4c93d5102d53fdff1cf23553d6", "support" ], "css/support/parsing-testcommon.js": [ @@ -359530,6 +360900,582 @@ "427ab62baa011151f797d537e646961d7df78630", "support" ], + "css/vendor-imports/mozilla/mozilla-central-reftests/OWNERS": [ + "5f43f9116bc8073cfadd3bf840519a3ad96c296f", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001-ref.html": [ + "98b4bd95823d4a14a52bbcf176f3dfbbbc211d54", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001.html": [ + "62a8ecb355d2b37a6d6006d97ff206352139f5e6", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002-ref.html": [ + "b9bde37740edd87ab94a6fffbf115a9f7c74bd89", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002.html": [ + "d546bf55394d07458dbf6f4bf380be68bf151899", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003-ref.html": [ + "3d4867f617c4bdf092f4848808b53e42c0611b79", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003.html": [ + "3960f474c9b59999f849f204dc94bfc47cd7a6f4", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004-ref.html": [ + "82399e3accfaf678467501436c265aa4375cb4d6", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004.html": [ + "a1b00544f8518a2b67aafe341ae34f88c8f20ed2", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005-ref.html": [ + "8d853a84df64f822d03ae2456a66b13b68e71064", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005.html": [ + "65b744f8b829bc585f72eb2059bcc2dea860ab10", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006-ref.html": [ + "f4880c4d68de1344fab11e38909eff015235aef0", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006.html": [ + "209f0410d080212cdec5d432cc6eb9da7408a209", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007-ref.html": [ + "55a390da0cdb87c04c6480bd4596f110f32bd47b", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007.html": [ + "eb2365abbe462dbd13b59fd4d54f36da4dcf2881", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008-ref.html": [ + "f8b40d27e858f2e10dc76880a79f6cc3139813c7", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008.html": [ + "6dafc4636f4895d9f5f77b2d91b05638c31587a9", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001-ref.html": [ + "3d4867f617c4bdf092f4848808b53e42c0611b79", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001.html": [ + "e0d37083668202c47963d50603054ed11cabf276", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002-ref.html": [ + "989d6ac13d5e2ec7055dd349bc086d5c09fa26f0", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002.html": [ + "9f8ae7f4ce463203fce9429f5fcedd4262a1a8da", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001-ref.html": [ + "989d6ac13d5e2ec7055dd349bc086d5c09fa26f0", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001.html": [ + "456cc59a339da0009c961d135e68a4384495f9da", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002-ref.html": [ + "3d4867f617c4bdf092f4848808b53e42c0611b79", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002.html": [ + "f1013db1db09986a4d53ff90fbca66a21923b6ef", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001-ref.html": [ + "6c0f732532d190535baa258787887c0ddd703fa2", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001.html": [ + "6aad51819716b774abb65973b4bd2e08e83cd7c9", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002-ref.html": [ + "c1715dcd64c36fd6d37e283cb4d0a5526f30e0c4", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002.html": [ + "06956ba2cb680f32af5f42802b7cb80f45b1008b", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003-ref.html": [ + "d1b2c59990618c9bc2788cb67c3394ae977b134e", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003.html": [ + "247f5216a8cca57ce96062e8f809ecf5411b84fd", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004-ref.html": [ + "24fb8a1e7fd4bf36073d0658680c090c8ca46400", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004.html": [ + "e684dd6bfef15f72ef1c90e06e0192b899592548", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005-ref.html": [ + "9d8f4469ac36d78c566fb0a07200124e38aa10b0", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005.html": [ + "1421878e4fbbb7002209422eb2a371f2025fbaa1", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006-ref.html": [ + "b3df68fab3c1812ae4bf7f24caa36f066330f71c", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006.html": [ + "aa093438f6bf47715f322cca649b93efed272976", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007-ref.html": [ + "a5316ce81107a5b5fa9875a120f7725955fefa35", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007.html": [ + "7721031b7ac4361ea3adbc2978d0966d7e079698", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008-ref.html": [ + "c40a2d75cf31a24051ec0a6a0cd7acf53d8a4ee4", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008.html": [ + "6bea8aaa00e0a90a2c3acda260f6a4ca2e00980b", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001-ref.html": [ + "75a998e34121bd8067a6694f523b32c0e928689a", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001.html": [ + "82120fb52e3c107d6247bbe8d5f77b737e764ecf", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002-ref.html": [ + "75a998e34121bd8067a6694f523b32c0e928689a", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002.html": [ + "1b2ff2e320b8b62c440bed66080fcf1419c79758", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003-ref.html": [ + "b48de7e5cb115ba2fd078163a852e4de62cba292", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003.html": [ + "498e230f92aaadc6facb8d148322eb6b61aaffc4", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004-ref.html": [ + "2ed4a2d798a77022534b133fad90b14c88db8a0c", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004.html": [ + "c4cb4b5138d5b0a4161222ac6193922639325109", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001-ref.html": [ + "fb1fb93ea997b1107efa595f17ae5b9c38419a92", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001.html": [ + "2577489655c3317781e1a91074f9e86ffa97900e", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001-ref.html": [ + "e9b697062418aa434d33e65f9295839ca9ff1175", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001.html": [ + "e2fe739a058f24849a0f8381d27502195cf8d6b5", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002-ref.html": [ + "4459c1a03c89349066235ead8a4e5ea24a2ac75f", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002.html": [ + "03f1a12910d7360d5773ccbce6447c7454206ed0", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003-ref.html": [ + "75a998e34121bd8067a6694f523b32c0e928689a", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003.html": [ + "c340cdc290fce5a73d89377176a1ef1d4aa4f5f3", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004-ref.html": [ + "a4be517ce0669defc631689e5208c3e7fa8abc4e", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004.html": [ + "5113cdd8ac2347f4876fc758f58c9ba810deb3d7", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001-ref.html": [ + "ec0d6cc41278ced0ad415544e73f1b6804e9f946", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001.html": [ + "e1c6b79076d5403fccb9473538fb3e6458b7c624", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001-ref.html": [ + "0abf592d6d476d0e5a9a01b163e3aebf9fffb74d", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001.html": [ + "88335dca854fcc1b2efef6b8ab35670fadfe3c4b", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001-ref.html": [ + "be61c53b491d8445aaedcc00dc42b1575994f533", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001.html": [ + "33cec45906af242cd971d7e088e8f438a59f9efe", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002-ref.html": [ + "be61c53b491d8445aaedcc00dc42b1575994f533", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002.html": [ + "68025bf739dec8287c3ebe91d7ea92903a52608f", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003-ref.html": [ + "f609ed2896af4c476dd7832a3c5071da48c240f8", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003.html": [ + "80c747700d22d6aa3b9dab5e687dc7404f63e99f", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004-ref.html": [ + "f609ed2896af4c476dd7832a3c5071da48c240f8", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004.html": [ + "6c0f8e4ea685b6c0fd79d57fa2eaf32f69af01e2", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005-ref.html": [ + "b04e8f2337660a2147f63736beb0603255768c8c", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005.html": [ + "83703c8adc5d419f53d5c84729b6079c24f89bc8", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006-ref.html": [ + "b04e8f2337660a2147f63736beb0603255768c8c", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006.html": [ + "f30bd06737c52939788ca5988ef3c65278d50808", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007-ref.html": [ + "2da4bf974f674b2692520ecd40c503392c31087b", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007.html": [ + "4eef2a7bfd58a08bd92783cbfb3be9b45487f993", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008-ref.html": [ + "2da4bf974f674b2692520ecd40c503392c31087b", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008.html": [ + "375e9aadbe0b09b7b14e82e8f119b7dcad691005", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001-ref.html": [ + "2c70fa14a6464d28dcd656f4f429beae9e892ec0", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001.html": [ + "5143a56423277f7516fdbc59041dcb2f5ea389e1", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002-ref.html": [ + "8901d350f84c19eacbc478d40ebcc00c210ad090", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002.html": [ + "d56a25c3c9662af6d8c6099c26d461c34b789340", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001-ref.html": [ + "64a85443a4b85aa8a7b791b96b62bc29a8f994f3", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001.html": [ + "8971b4b9de543a2e337190a5da05cc7e8cac4d56", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002-ref.html": [ + "3e109d01e63c4b612543d24018e98a6f9ddebc76", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002.html": [ + "59ea15340cbb4f3f0a45cd59730594c58cbfb640", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001-ref.html": [ + "d4f75a036ad049006776fe8f5e44b165f4a2867a", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001.html": [ + "90f328e3a8efdb4d38a56e461b1fd491b87ddec9", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001-ref.html": [ + "428aeae649464b16992800ba324ec23bececc1f8", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001.html": [ + "7a42e0def8710bb7a614681025ba805997e80020", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002-ref.html": [ + "38cfdff074c539efa2ba41492e6327b5d775b0ea", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002.html": [ + "51b70d69124152b668a1e335c8457cbae8e2d5c6", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001-ref.html": [ + "36b570f24580adebdeee7afb9c8147e85da4fd2f", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001.html": [ + "191d6b84cb6b98e0b84b6c46ccc0a6f7ce795191", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002-ref.html": [ + "40dd0f2f5173b4d8e544c47fba6c2eb62dee4faf", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002.html": [ + "b9ee7277ab9554e9d515b5c6b7c8badc72260b84", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001-ref.html": [ + "a14d630680fb8ccf5fcadeda56e7e95954479269", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001.html": [ + "fa4a56d4088039402b4d22f9aae45da6379fde72", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002-ref.html": [ + "ea15f8de198622cdc8472b28a3c7235b4c921205", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002.html": [ + "5fca4c308266de9b130faaebc852774f0a8d8c8d", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001-ref.html": [ + "671b315a147a361e87d67d8be4a210c79aa3e99b", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001.html": [ + "1e7a125d9fee2ed8f2ce62ce6b34be873941e715", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002-ref.html": [ + "671b315a147a361e87d67d8be4a210c79aa3e99b", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002.html": [ + "7274c116f3f8d2e3cfab8b5f93a0f9ee04a39b49", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003-ref.html": [ + "cadaadd95a35752e6a93564349ddb8bafdc2aeda", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003.html": [ + "f8539f8b9fa40dc83c5e169af2474ab4b920fa81", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004-ref.html": [ + "cadaadd95a35752e6a93564349ddb8bafdc2aeda", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004.html": [ + "b891d541596e0dd13ba41a9f19227e54e421b1c1", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001-ref.html": [ + "5e7fd9f9a9bb52235d9bca30dec9297011dfa06c", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001.html": [ + "f8cfa793eb7a81015e4fe6b2adb2dbcaf4d7a2fe", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001-ref.html": [ + "37575f03e53830976da0937ea08aea9c178c9ead", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001.html": [ + "273abb150043d061dc72a8ed3c870a18670db4a0", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002-ref.html": [ + "ce217e7fffbe933016bb77a0117b0d230c0f276b", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002.html": [ + "2156f4bbf5191069d9183dfd23697f855f64971f", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003-ref.html": [ + "7eca626d2df3522741a36169ae2776eb9735c633", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003.html": [ + "b727d3b37ed6b79ec1cd28a1f362e6eb22e17d3f", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004-ref.html": [ + "66d0d29f3c3e6bc459bd37d24a0a3448d81fd472", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004.html": [ + "f350ef8ce6571101ab6b158c36b9baa78fa91c87", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001-ref.html": [ + "6d197e490fe69c5e45f48d884fe265e5080c97e0", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001.html": [ + "99cfcbb9b4e65447a5e950d06e7d563e70a46037", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002-ref.html": [ + "f7396eda984b03ffd8660f5287963448c9d552e2", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002.html": [ + "b82d308af1b7e1c289680a581e706627dd461126", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001-ref.html": [ + "78d621219ab0fd36fb625252a977ab1166e0c42b", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001.html": [ + "fdd4f6220be512fa581152960147f01dd0ea2d25", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002-ref.html": [ + "e71555d429498deae363039e015ef303aa2c6f68", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002.html": [ + "61c1b97b51f84040be5647d0dc9a2a2eaff96a43", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001-ref.html": [ + "8e5db1efc59b812a5ef71b90ccd94bbc7e48f870", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001.html": [ + "18e024bf2e8e49a15f2cecba34cb83ac4fa9eb11", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002-ref.html": [ + "c7176a7c21025ac178194c3592ef2fe30e4a86ee", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002.html": [ + "d7e510e1b5eee5987c49eeec9c11667117d64bb2", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003-ref.html": [ + "8c88ad97b9c456702e2c649b2fb486f06538ca85", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003.html": [ + "2224ff684aff7ef3c7a5639dd4951e9e8febc450", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004-ref.html": [ + "3e4c10049db205a89e0f3462f96ef5386e29296f", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004.html": [ + "a22fdc24fb72284ac13327d99592cac0edc8198a", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001-ref.html": [ + "9fff3eabcc0860a981714bb81895b61560861d07", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001.html": [ + "1bc2a5c33869d95f6486561e19bb6df0f7b973df", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002-ref.html": [ + "9fff3eabcc0860a981714bb81895b61560861d07", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002.html": [ + "7b72c6aaeb17bf164263b2dc02cb958ab13a36b6", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003-ref.html": [ + "c0d0b784415ad0c1b2e8af582aec8825c4860c71", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003.html": [ + "582262bd3deb174ba560467c971d190d6fceb4a8", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004-ref.html": [ + "c0d0b784415ad0c1b2e8af582aec8825c4860c71", + "support" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004.html": [ + "63c893b6c4f116a2ab39124220767a64eb424ffa", + "reftest" + ], + "css/vendor-imports/mozilla/mozilla-central-reftests/align3/support/colors-8x16.png": [ + "596fdb389d6cedd10f54939edd07dacb0e615ac2", + "support" + ], "css/vendor-imports/mozilla/mozilla-central-reftests/break3/moz-block-fragmentation-001-ref.html": [ "cf345b59638f28ddf423ed343a269178ab47f1b9", "support" @@ -380938,6 +382884,14 @@ "7bd2cedb1b6771398c808d1b7c8f68840bfb9b6f", "reftest" ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size-expected.txt": [ + "ed26217f6f1514d56789f18850a181a01ca034b8", + "support" + ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size.html": [ + "1c221555c305bd9039558389b3f22ee00d65f8b9", + "testharness" + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-padding.html": [ "61ad4ed4c9445a3c035f85db7ab0928cbb11b91a", "testharness" @@ -380962,6 +382916,14 @@ "c11b466669665a29fc4f33b4bbc14c6b5598d545", "reftest" ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self-expected.txt": [ + "784705ba5b2ead1c5413ad3b85d035786d06ca56", + "support" + ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self.html": [ + "29df29d17778a9d3d592c5e942f093a44f419b3c", + "testharness" + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align-expected.txt": [ "ac67e7714a9b22d6575897238b287748dd887633", "support" @@ -380986,6 +382948,14 @@ "4e9539179739a3690aab276f2ba98c25bd4dfe9b", "testharness" ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins-ref.html": [ + "f2701d26f3213e02eee9d3592bbeae7da7e7b898", + "support" + ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins.html": [ + "98cd16c7c147316669eb6c456538f43ae90fbf44", + "reftest" + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-expected.txt": [ "f9a02c9301a9d2b3ce66225801ff39f6edb606f8", "support" @@ -381002,6 +382972,14 @@ "689454ac493a05b28658edf549d71c6aa1c7be0e", "testharness" ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering-ref.html": [ + "189b195f6154e7afc354726a13f8e79290f6edfb", + "support" + ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering.html": [ + "ba6610503a6d14cf8d9a7b661cb76f3350317d2c", + "reftest" + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display.html": [ "914547fc6cdde3e464b28eb7cc9737d17305f9af", "testharness" @@ -381038,6 +383016,10 @@ "c26b50ce662cbea50a69e8e718b9b2b889568f64", "reftest" ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-margin-inline.html": [ + "8daf78db999c8c437d311c8bb2f7b36f590ae277", + "testharness" + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-position-relative-ref.html": [ "fd6c11a00566759fbf1e749d49ad396cf1a7ee08", "support" @@ -393435,7 +395417,7 @@ "testharness" ], "mediacapture-image/ImageCapture-MediaTrackSupportedConstraints.html": [ - "59a54f51d600fa5c8ee1c092afa5a07f6ae2ae3f", + "9ec5261b9dc48ea143c60946d72233a9eb5d7261", "testharness" ], "mediacapture-image/ImageCapture-creation.https.html": [ @@ -393459,15 +395441,15 @@ "testharness" ], "mediacapture-image/MediaStreamTrack-applyConstraints-getSettings.html": [ - "1a1b58e5415f9e04ddeb8d1874448c3b98af35e3", + "4900336549f4a92f449233d24abf97f84f055102", "testharness" ], "mediacapture-image/MediaStreamTrack-applyConstraints-reject.html": [ - "8f08d250fd1a569d84ecd4ce36fe5ffa29f583f7", + "21719636ea870f0cfe8e3b8c8a0c838512c1eb87", "testharness" ], "mediacapture-image/MediaStreamTrack-applyConstraints.html": [ - "8dcff926173266c9e5f14c37ff408832a8a07d7e", + "c87f954c682cb6869040ebc67f6245902cec1267", "testharness" ], "mediacapture-image/MediaStreamTrack-getCapabilities-fast.html": [ @@ -393475,11 +395457,11 @@ "testharness" ], "mediacapture-image/MediaStreamTrack-getCapabilities.html": [ - "eceaf5b1a8665211e42094730619d38143782fdc", + "9e34f2389cc4e446767df2aa4991cb43b8c95c7a", "testharness" ], "mediacapture-image/MediaStreamTrack-getConstraints-fast.html": [ - "5a5ce5f2dad58cb47e8b4215bc563e24b34b3119", + "16f869cf119faa7eaa043ff6d65fa31b2998315b", "testharness" ], "mediacapture-image/MediaStreamTrack-getSettings-fast.html": [ @@ -393487,7 +395469,7 @@ "testharness" ], "mediacapture-image/MediaStreamTrack-getSettings.html": [ - "5e9256eeb740663675ea93d692481556efd97628", + "8535f298bfab2ebca9dd3b37a0cc4f8538623203", "testharness" ], "mediacapture-image/detached-HTMLCanvasElement.html": [ @@ -404470,12 +406452,16 @@ "43d0aa5d38b2ac65b5100c9ba8fa2b794ffd03ee", "testharness" ], + "pointerevents/extension/pointerevent_getCoalescedEvents_when_pointerlocked-manual.html": [ + "6efded85b4562bd960a4b5e584e68984a1ce6316", + "manual" + ], "pointerevents/extension/pointerevent_pointerrawmove-manual.html": [ "0c4ccf9ad48d49c62b3d138845dfa3ac631a8e4e", "manual" ], "pointerevents/extension/pointerevent_pointerrawmove_in_pointerlock-manual.html": [ - "30fff15bd92f536de826b7ef98419b6a30284d41", + "970355863bb7d6affb0b50289af75b98cfccbb57", "manual" ], "pointerevents/extension/pointerevent_touch-action-pan-down-css_touch-manual.html": [ @@ -404782,10 +406768,22 @@ "d8dbeaae172dfd6314341c55ef1fa3b9945f60fc", "manual" ], + "pointerevents/pointerlock/pointerevent_pointermove_in_pointerlock-manual.html": [ + "80c01d61c8f906364fea0497d32cbd44ad8fdd3f", + "manual" + ], + "pointerevents/pointerlock/pointerevent_pointermove_on_chorded_mouse_button_when_locked-manual.html": [ + "b2fadbfe05f7efcc674f2b4cac61a15a67560597", + "manual" + ], "pointerevents/pointerlock/resources/pointerevent_movementxy-iframe.html": [ "627af3b61cad74bb112558169b1e66f6a24b1129", "support" ], + "pointerevents/pointerlock/resources/pointerevent_pointermove_in_pointerlock-iframe.html": [ + "b7cc7068e96c7dbbf7f8ffa9e5ce9bd1ce63686f", + "support" + ], "pointerevents/resources/pointerevent_attributes_hoverable_pointers-iframe.html": [ "5e55868282ce5ce549f1d32092839f05bd43aba7", "support" @@ -413887,11 +415885,11 @@ "support" ], "resources/chromium/image_capture.mojom.js": [ - "11123feb87d06d53f8e933aa18fad118ae6c8737", + "bf8dd16ca75d4be1095808138d09a9c400159b86", "support" ], "resources/chromium/mock-imagecapture.js": [ - "878f59eb0095b65cabffe95c5538bcb79fa97b0d", + "329cbc3a761dc5720b7a67ed09ef68aec6a8bc3d", "support" ], "resources/chromium/mojo_bindings.js": [ @@ -417998,6 +419996,10 @@ "2d6a5e36585b623a89b1e5f4e059d881027a0b94", "testharness" ], + "shadow-dom/event-dispatch-order.tentative.html": [ + "1e88740f53a2dc25d9650e4f54c3011e2b0e9355", + "testharness" + ], "shadow-dom/event-inside-shadow-tree.html": [ "a7405a59560c790c5708a7eaa4e65b6669adc0dd", "testharness" @@ -418071,7 +420073,7 @@ "support" ], "shadow-dom/resources/shadow-dom.js": [ - "3e55684dac1c4fbe1064c6d5d8b8d7ee86224921", + "192ad45413035ae629ba8158a5ceaca171af11fa", "support" ], "shadow-dom/scroll-to-the-fragment-in-shadow-tree.html": [ @@ -420355,7 +422357,7 @@ "testharness" ], "svg/path/property/getComputedStyle.svg": [ - "5830191931fb4f7dd0d4e929333248b8d3019e79", + "392c570e3525062886f7d4bda0ab7e006e3e370c", "testharness" ], "svg/path/property/priority-ref.svg": [ @@ -420370,6 +422372,10 @@ "b7f8cd308d7cbcf1aaa4ab686179e456f61c7d6f", "support" ], + "svg/path/property/serialization.svg": [ + "297f8ede687a28a12ced98a4b89051dd9ddf5090", + "testharness" + ], "svg/pservers/reftests/radialgradient-basic-002-ref.svg": [ "26f4f508f35855ffd35baffb1aff129fe1ebf1be", "support" @@ -425051,11 +427057,11 @@ "testharness" ], "webrtc/RTCConfiguration-iceServers-expected.txt": [ - "9c67e8d4c02c91c0b0746b983fcbd6ca96d99e75", + "e21f127252a3ad9f9555cf9f44e7d27e4b5fcbbd", "support" ], "webrtc/RTCConfiguration-iceServers.html": [ - "6069c25af4accf7334f25f1bd30b687c2022aa6c", + "3f5c367d3ad98186461864b6b0bdecee3a07319e", "testharness" ], "webrtc/RTCConfiguration-iceTransportPolicy-expected.txt": [
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/inheritance.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/inheritance.html new file mode 100644 index 0000000..7e2fa13 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/inheritance.html
@@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Inheritance of CSS Box Alignment properties</title> +<link rel="help" href="https://drafts.csswg.org/css-align-3/#property-index"> +<meta name="assert" content="Properties inherit or not according to the spec."> +<meta name="assert" content="Properties have initial values according to the spec."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/inheritance-testcommon.js"></script> +</head> +<body> +<div id="container"> +<div id="target"></div> +</div> +<style> +#container { + justify-items: legacy center; +} +</style> +<script> +assert_not_inherited('align-content', 'normal', 'last baseline'); +assert_not_inherited('align-items', 'normal', 'last baseline'); +assert_not_inherited('align-self', 'auto', 'last baseline'); +assert_not_inherited('column-gap', 'normal', '10px'); +assert_not_inherited('justify-content', 'normal', 'space-evenly'); +assert_not_inherited('justify-items', 'legacy center', 'last baseline'); +assert_not_inherited('justify-self', 'auto', 'last baseline'); +assert_not_inherited('row-gap', 'normal', '10px'); +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/inheritance.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/inheritance.html new file mode 100644 index 0000000..eee86f7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/inheritance.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Inheritance of CSS Grid Layout properties</title> +<link rel="help" href="https://drafts.csswg.org/css-grid/#property-index"> +<meta name="assert" content="Properties inherit or not according to the spec."> +<meta name="assert" content="Properties have initial values according to the spec."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/inheritance-testcommon.js"></script> +</head> +<body> +<div id="container"> +<div id="target"></div> +</div> +<script> +assert_not_inherited('grid-auto-columns', 'auto', '10px'); +assert_not_inherited('grid-auto-flow', 'row', 'column dense'); +assert_not_inherited('grid-auto-rows', 'auto', '10px'); +assert_not_inherited('grid-column-end', 'auto', 'span 2'); +assert_not_inherited('grid-column-start', 'auto', 'span 2'); +assert_not_inherited('grid-row-end', 'auto', 'span 2'); +assert_not_inherited('grid-row-start', 'auto', 'span 2'); +assert_not_inherited('grid-template-areas', 'none', '"one two" "three four"'); +assert_not_inherited('grid-template-columns', 'none', '10px'); +assert_not_inherited('grid-template-rows', 'none', '10px'); +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-inline/inheritance-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/css/css-inline/inheritance-expected.txt index 80dba45a..18b9e4e2 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-inline/inheritance-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-inline/inheritance-expected.txt
@@ -4,7 +4,7 @@ PASS Property baseline-shift has initial value 0px PASS Property baseline-shift does not inherit FAIL Property dominant-baseline has initial value normal assert_equals: expected "normal" but got "auto" -FAIL Property dominant-baseline inherits assert_not_equals: got disallowed value "central" +PASS Property dominant-baseline inherits PASS Property initial-letters has initial value normal PASS Property initial-letters does not inherit PASS Property initial-letters-align has initial value alphabetic
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-text-decor/inheritance.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-text-decor/inheritance.html new file mode 100644 index 0000000..17486f1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-text-decor/inheritance.html
@@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Inheritance of CSS Text Decoration properties</title> +<link rel="help" href="https://drafts.csswg.org/css-text-decor-3/#property-index"> +<meta name="assert" content="Properties inherit or not according to the spec."> +<meta name="assert" content="Properties have initial values according to the spec."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/inheritance-testcommon.js"></script> +</head> +<body> +<div id="container"> +<div id="target"></div> +</div> +<style> +#container { + color: rgba(2, 3, 4, 0.5); +} +</style> +<script> +assert_not_inherited('text-decoration-color', 'rgba(2, 3, 4, 0.5)', 'rgba(42, 53, 64, 0.75)'); +assert_not_inherited('text-decoration-line', 'none', 'line-through'); +assert_not_inherited('text-decoration-style', 'solid', 'dashed'); +assert_inherited('text-emphasis-color', 'rgba(2, 3, 4, 0.5)', 'rgba(42, 53, 64, 0.75)'); +assert_inherited('text-emphasis-position', 'over right', 'under left'); +assert_inherited('text-emphasis-style', 'none', 'filled triangle'); +assert_inherited('text-shadow', 'none', 'rgba(42, 53, 64, 0.75) 10px 20px 0px'); +assert_inherited('text-underline-position', 'auto', 'under'); +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-values/calc-integer-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/css/css-values/calc-integer-expected.txt new file mode 100644 index 0000000..3c23adf --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-values/calc-integer-expected.txt
@@ -0,0 +1,10 @@ +This is a testharness.js-based test. +FAIL Sanity assert_equals: expected "2" but got "auto" +FAIL Basic division works assert_equals: expected "2" but got "auto" +FAIL Rounds up if fractional part is >= 0.5 assert_equals: expected "1" but got "auto" +FAIL Accepts numbers, and rounds assert_equals: expected "1" but got "auto" +FAIL Operation between <integer> and <number> works assert_equals: expected "3" but got "auto" +FAIL Rounds down if fractional part is < 0.5 assert_equals: expected "0" but got "auto" +FAIL Only rounds at the end of the conversion assert_equals: expected "1" but got "auto" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-values/calc-integer.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-values/calc-integer.html new file mode 100644 index 0000000..821dac4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-values/calc-integer.html
@@ -0,0 +1,58 @@ +<!doctype html> +<meta charset="utf-8"> +<title>CSS Tests: calc() and division for integers</title> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> +<link rel="author" title="Mozilla" href="https://mozilla.org"> +<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-range"> +<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2337"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="test"></div> +<script> +const TESTS = [ + { + specified: "calc(2)", + computed: "2", + description: "Sanity", + }, + { + specified: "calc(4 / 2)", + computed: "2", + description: "Basic division works", + }, + { + specified: "calc(1 / 2)", + computed: "1", + description: "Rounds up if fractional part is >= 0.5", + }, + { + specified: "calc(0.5)", + computed: "1", + description: "Accepts numbers, and rounds", + }, + { + specified: "calc(6 / 2.0)", + computed: "3", + description: "Operation between <integer> and <number> works", + }, + { + specified: "calc(1 / 3)", + computed: "0", + description: "Rounds down if fractional part is < 0.5", + }, + { + specified: "calc(calc(1 / 3) * 3)", + computed: "1", + description: "Only rounds at the end of the conversion", + } +]; + +const testElement = document.getElementById("test"); +for (const { specified, computed, description } of TESTS) { + test(function() { + testElement.style.zIndex = "42"; // Just something that we know it's valid and makes tests not rely on order. + testElement.style.zIndex = specified; + assert_equals(getComputedStyle(testElement).zIndex, computed); + }, description); +} +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/support/inheritance-testcommon.js b/third_party/WebKit/LayoutTests/external/wpt/css/support/inheritance-testcommon.js index 50bf4c3ae..1a4d2fee 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/support/inheritance-testcommon.js +++ b/third_party/WebKit/LayoutTests/external/wpt/css/support/inheritance-testcommon.js
@@ -24,10 +24,10 @@ assert_equals(getComputedStyle(container)[property], other); assert_equals(getComputedStyle(target)[property], other); target.style[property] = 'initial'; - assert_not_equals(getComputedStyle(container)[property], other); + assert_equals(getComputedStyle(container)[property], other); assert_not_equals(getComputedStyle(target)[property], other); target.style[property] = 'inherit'; - assert_equals(getComputedStyle(container)[property], other); + assert_equals(getComputedStyle(target)[property], other); container.style[property] = ''; target.style[property] = ''; }, 'Property ' + property + ' inherits');
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001-ref.html new file mode 100644 index 0000000..98b4bd9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001-ref.html
@@ -0,0 +1,99 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001.html new file mode 100644 index 0000000..62a8ecb3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-001.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row wrap; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002-ref.html new file mode 100644 index 0000000..b9bde377 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002-ref.html
@@ -0,0 +1,99 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002.html new file mode 100644 index 0000000..d546bf5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-002.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row wrap-reverse flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003-ref.html new file mode 100644 index 0000000..3d4867f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003.html new file mode 100644 index 0000000..3960f474 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-003.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row-reverse flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-003-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row-reverse wrap; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004-ref.html new file mode 100644 index 0000000..82399e3a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004.html new file mode 100644 index 0000000..a1b0054 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-004.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row-reverse wrap-reverse flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-004-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row-reverse wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005-ref.html new file mode 100644 index 0000000..8d853a84 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005-ref.html
@@ -0,0 +1,99 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005.html new file mode 100644 index 0000000..65b744f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-005.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-005-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column wrap; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006-ref.html new file mode 100644 index 0000000..f4880c4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006-ref.html
@@ -0,0 +1,99 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006.html new file mode 100644 index 0000000..209f0410 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-006.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column wrap-reverse flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-006-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007-ref.html new file mode 100644 index 0000000..55a390da --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-top: 4px; } + .small > .container > * { margin-top: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007.html new file mode 100644 index 0000000..eb2365a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-007.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column-reverse flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-007-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column-reverse wrap; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008-ref.html new file mode 100644 index 0000000..f8b40d27 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-top: 4px; } + .small > .container > * { margin-top: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008.html new file mode 100644 index 0000000..6dafc463 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-008.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column-reverse wrap-reverse flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-008-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column-reverse wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001-ref.html new file mode 100644 index 0000000..3d4867f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001.html new file mode 100644 index 0000000..e0d3708 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-001.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a RTL row flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-rtl-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row wrap; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002-ref.html new file mode 100644 index 0000000..989d6ac1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002-ref.html
@@ -0,0 +1,99 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { margin-left: 8px } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { /* nothing special */ } + .small .alignStart { margin-left: -4px } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { /* nothing special */ } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002.html new file mode 100644 index 0000000..9f8ae7f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-rtl-002.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a RTL column flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-rtl-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column wrap; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001-ref.html new file mode 100644 index 0000000..989d6ac1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001-ref.html
@@ -0,0 +1,99 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { margin-left: 8px } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { /* nothing special */ } + .small .alignStart { margin-left: -4px } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { /* nothing special */ } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001.html new file mode 100644 index 0000000..456cc59 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-001.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a vertical-rl row flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-vertWM-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row wrap; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002-ref.html new file mode 100644 index 0000000..3d4867f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignCenter"><!--normal--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignCenter"><!--stretch (+ align-self:center)--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002.html new file mode 100644 index 0000000..f1013db1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-content-vertWM-002.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a vertical-rl column flex container, with various "align-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-content-vertWM-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column wrap; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + /* This "align-self" only gets a chance to take effect when our container + has "align-content: stretch". In that case, it helps us verify that + the container's "align-content: stretch" is actually taking effect + and stretching the flex line (and giving us space to center in). */ + align-self: center; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="align-content: normal"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container" style="align-content: baseline"><div></div></div> + <div class="container" style="align-content: last baseline"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="align-content: center"><div></div></div> + <div class="container" style="align-content: start"><div></div></div> + <div class="container" style="align-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="align-content: flex-start"><div></div></div> + <div class="container" style="align-content: flex-end"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001-ref.html new file mode 100644 index 0000000..6c0f732 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001.html new file mode 100644 index 0000000..6aad518 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-001.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002-ref.html new file mode 100644 index 0000000..c1715dc --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002.html new file mode 100644 index 0000000..06956ba2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-002.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row wrap-reverse flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003-ref.html new file mode 100644 index 0000000..d1b2c59 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003.html new file mode 100644 index 0000000..247f5216 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-003.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row-reverse flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-003-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004-ref.html new file mode 100644 index 0000000..24fb8a1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004.html new file mode 100644 index 0000000..e684dd6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row-reverse wrap-reverse flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-004-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row-reverse wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005-ref.html new file mode 100644 index 0000000..9d8f4469 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005.html new file mode 100644 index 0000000..1421878e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-005.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-005-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006-ref.html new file mode 100644 index 0000000..b3df68f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006.html new file mode 100644 index 0000000..aa09343 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-006.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column wrap-reverse flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-006-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007-ref.html new file mode 100644 index 0000000..a5316ce --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-top: 4px; } + .small > .container > * { margin-top: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007.html new file mode 100644 index 0000000..7721031b7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-007.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column-reverse flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-007-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008-ref.html new file mode 100644 index 0000000..c40a2d75 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-top: 4px; } + .small > .container > * { margin-top: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008.html new file mode 100644 index 0000000..6bea8aa --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-008.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column-reverse wrap-reverse flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-008-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column-reverse wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001-ref.html new file mode 100644 index 0000000..75a998e3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001.html new file mode 100644 index 0000000..82120fb5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-001.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a RTL row flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-rtl-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002-ref.html new file mode 100644 index 0000000..75a998e3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002.html new file mode 100644 index 0000000..1b2ff2e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-002.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos LTR children in a RTL row flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-rtl-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + direction: ltr; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003-ref.html new file mode 100644 index 0000000..b48de7e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { margin-left: 8px } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { /* nothing special */ } + .small .alignStart { margin-left: -4px } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { /* nothing special */ } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003.html new file mode 100644 index 0000000..498e230 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-003.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a RTL column flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-rtl-003-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004-ref.html new file mode 100644 index 0000000..2ed4a2d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { margin-left: 8px } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { /* nothing special */ } + .small .alignStart { margin-left: -4px } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { /* nothing special */ } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004.html new file mode 100644 index 0000000..c4cb4b51 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-rtl-004.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos LTR children in a RTL column flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-rtl-004-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + direction: ltr; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001-ref.html new file mode 100644 index 0000000..fb1fb93 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001-ref.html
@@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0 +--> +<html> +<head> + <title>Reference: Testing safe overflow-position for align-self in absolutely positioned boxes in flex containers</title> + <link rel="author" title="Mihir Iyer" href="mailto:miyer@mozilla.com"> + <meta charset="utf-8"> + <style> + .flex { + display: flex; + height: 50px; + width: 50px; + border: 3px solid black; + vertical-align: top; + margin: 20px; + position: relative; + } + .child { + border: 2px dotted purple; + background: teal; + width: 65px; + height: 65px; + align-self: start; + position: absolute; + background: yellow; + } + .rowDir { + flex-direction: row; + } + .colDir { + flex-direction: column; + } + .vertRL { + writing-mode: vertical-rl; + } + </style> +</head> +<body> + <div class="flex rowDir"><div class="child"></div></div> + <div class="flex colDir"><div class="child"></div></div> + <div class="flex rowDir vertRL"><div class="child"></div></div> + <div class="flex colDir vertRL"><div class="child"></div></div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001.html new file mode 100644 index 0000000..2577489 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-safe-001.html
@@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0 +--> +<html> +<head> + <title>CSS Test: Testing safe overflow-position for align-self in absolutely positioned boxes in flex containers</title> + <link rel="author" title="Mihir Iyer" href="mailto:miyer@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#overflow-values"> + <link rel="match" href="flex-abspos-staticpos-align-self-safe-001-ref.html"> + <meta charset="utf-8"> + <style> + .flex { + display: flex; + height: 50px; + width: 50px; + border: 3px solid black; + vertical-align: top; + margin: 20px; + position: relative; + } + .child { + border: 2px dotted purple; + background: teal; + width: 65px; + height: 65px; + align-self: safe center; + position: absolute; + background: yellow; + } + .rowDir { + flex-direction: row; + } + .colDir { + flex-direction: column; + } + .vertRL { + writing-mode: vertical-rl; + } + </style> +</head> +<body> + <div class="flex rowDir"><div class="child"></div></div> + <div class="flex colDir"><div class="child"></div></div> + <div class="flex rowDir vertRL"><div class="child"></div></div> + <div class="flex colDir vertRL"><div class="child"></div></div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001-ref.html new file mode 100644 index 0000000..e9b69706 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001-ref.html
@@ -0,0 +1,99 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { margin-left: 8px } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { /* nothing special */ } + .small .alignStart { margin-left: -4px } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { /* nothing special */ } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001.html new file mode 100644 index 0000000..e2fe739 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-001.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a vertical-rl row flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-vertWM-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002-ref.html new file mode 100644 index 0000000..4459c1a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002-ref.html
@@ -0,0 +1,99 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { margin-left: 8px } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { /* nothing special */ } + .small .alignStart { margin-left: -4px } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { /* nothing special */ } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002.html new file mode 100644 index 0000000..03f1a12 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-002.html
@@ -0,0 +1,99 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos horizontal-tb children in a vertical-rl row flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-vertWM-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + writing-mode: horizontal-tb; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003-ref.html new file mode 100644 index 0000000..75a998e3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003.html new file mode 100644 index 0000000..c340cdc --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a vertical-rl column flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-vertWM-003-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004-ref.html new file mode 100644 index 0000000..a4be517ce --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004.html new file mode 100644 index 0000000..5113cdd --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-004.html
@@ -0,0 +1,96 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos vertical-lr + RTL children in a vertical-rl column flex container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-align-self-vertWM-004-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + writing-mode: vertical-lr; + direction: rtl; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001-ref.html new file mode 100644 index 0000000..ec0d6cc --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001-ref.html
@@ -0,0 +1,87 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- <content-distribution> with implied fallback --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-distribution> with explicit "flex-end" fallback --> + <div style="display: none"> + <!-- + These tests will be valid when + https://github.com/w3c/csswg-drafts/issues/1002 is fixed + --> + <div class="container"><div class="alignEnd"><!--space-between--></div></div> + <div class="container"><div class="alignEnd"><!--space-around--></div></div> + <div class="container"><div class="alignEnd"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + </div> + <br> + </div> + <div class="small"> + <!-- <content-distribution> with implied fallback --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-distribution> with explicit "flex-end" fallback --> + <div style="display: none"> + <!-- + These tests will be valid when + https://github.com/w3c/csswg-drafts/issues/1002 is fixed + --> + <div class="container"><div class="alignEnd"><!--space-between--></div></div> + <div class="container"><div class="alignEnd"><!--space-around--></div></div> + <div class="container"><div class="alignEnd"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + </div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001.html new file mode 100644 index 0000000..e1c6b79 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-align-content-001.html
@@ -0,0 +1,76 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row flex container, with various "align-content" values with explicit fallback values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-fallback-align-content-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row wrap; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- <content-distribution> with implied fallback --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-distribution> with explicit "flex-end" fallback --> + <!-- + <div class="container" style="align-content: space-between flex-end"><div></div></div> + <div class="container" style="align-content: space-around flex-end"><div></div></div> + <div class="container" style="align-content: space-evenly flex-end"><div></div></div> + <div class="container" style="align-content: stretch flex-end"><div></div></div> + --> + <br> + </div> + <div class="small"> + <!-- <content-distribution> with implied fallback --> + <div class="container" style="align-content: space-between"><div></div></div> + <div class="container" style="align-content: space-around"><div></div></div> + <div class="container" style="align-content: space-evenly"><div></div></div> + <div class="container" style="align-content: stretch"><div></div></div> + <br> + <!-- <content-distribution> with explicit "flex-end" fallback --> + <!-- + <div class="container" style="align-content: space-between flex-end"><div></div></div> + <div class="container" style="align-content: space-around flex-end"><div></div></div> + <div class="container" style="align-content: space-evenly flex-end"><div></div></div> + <div class="container" style="align-content: stretch flex-end"><div></div></div> + --> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001-ref.html new file mode 100644 index 0000000..0abf592 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001-ref.html
@@ -0,0 +1,79 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- <content-distribution> with implied fallback --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-distribution> with explicit "flex-end" fallback --> + <div style="display: none"> + <div class="container"><div class="alignEnd"><!--space-between--></div></div> + <div class="container"><div class="alignEnd"><!--space-around--></div></div> + <div class="container"><div class="alignEnd"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + </div> + <br> + </div> + <div class="small"> + <!-- <content-distribution> with implied fallback --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-distribution> with explicit "flex-end" fallback --> + <div style="display: none"> + <div class="container"><div class="alignEnd"><!--space-between--></div></div> + <div class="container"><div class="alignEnd"><!--space-around--></div></div> + <div class="container"><div class="alignEnd"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + </div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001.html new file mode 100644 index 0000000..88335dca --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-fallback-justify-content-001.html
@@ -0,0 +1,80 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row flex container, with various "justify-content" values with explicit fallback values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-fallback-justify-content-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- <content-distribution> with implied fallback --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-distribution> with explicit "flex-end" fallback --> + <!-- TODO: https://github.com/w3c/csswg-drafts/issues/1002 + <div class="container" style="justify-content: space-between flex-end"><div></div></div> + <div class="container" style="justify-content: space-around flex-end"><div></div></div> + <div class="container" style="justify-content: space-evenly flex-end"><div></div></div> + <div class="container" style="justify-content: stretch flex-end"><div></div></div> + --> + <!-- Note: specifically for flex containers, in the justify-content axis, + "stretch behaves as flex-start (ignoring the specified fallback + alignment, if any." https://drafts.csswg.org/css-align-3/#distribution-flex --> + <br> + </div> + <div class="small"> + <!-- <content-distribution> with implied fallback --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-distribution> with explicit "flex-end" fallback --> + <!-- TODO: https://github.com/w3c/csswg-drafts/issues/1002 + <div class="container" style="justify-content: space-between flex-end"><div></div></div> + <div class="container" style="justify-content: space-around flex-end"><div></div></div> + <div class="container" style="justify-content: space-evenly flex-end"><div></div></div> + <div class="container" style="justify-content: stretch flex-end"><div></div></div> + --> + <!-- As noted above, the explicit fallback for "stretch" is ignored here. --> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001-ref.html new file mode 100644 index 0000000..be61c53 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001.html new file mode 100644 index 0000000..33cec45 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-001.html
@@ -0,0 +1,93 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002-ref.html new file mode 100644 index 0000000..be61c53 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002.html new file mode 100644 index 0000000..68025bf7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-002.html
@@ -0,0 +1,93 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row wrap-reverse flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003-ref.html new file mode 100644 index 0000000..f609ed28 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignEnd"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignEnd"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003.html new file mode 100644 index 0000000..80c74770 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003.html
@@ -0,0 +1,93 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row-reverse flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-003-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row-reverse wrap; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004-ref.html new file mode 100644 index 0000000..f609ed28 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { margin-left: 8px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { margin-left: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignEnd"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignEnd"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004.html new file mode 100644 index 0000000..6c0f8e4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-004.html
@@ -0,0 +1,93 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row-reverse wrap-reverse flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-004-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row-reverse wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005-ref.html new file mode 100644 index 0000000..b04e8f2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005.html new file mode 100644 index 0000000..83703c8a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-005.html
@@ -0,0 +1,93 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-005-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006-ref.html new file mode 100644 index 0000000..b04e8f2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006.html new file mode 100644 index 0000000..f30bd06 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-006.html
@@ -0,0 +1,93 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column wrap-reverse flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-006-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007-ref.html new file mode 100644 index 0000000..2da4bf9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignEnd"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignEnd"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007.html new file mode 100644 index 0000000..4eef2a7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-007.html
@@ -0,0 +1,93 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column-reverse flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-007-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column-reverse wrap; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008-ref.html new file mode 100644 index 0000000..2da4bf9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignEnd"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignEnd"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignEnd"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignEnd"><!--flex-start--></div></div> + <div class="container"><div class="alignStart"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008.html new file mode 100644 index 0000000..375e9aa --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-008.html
@@ -0,0 +1,93 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a column-reverse wrap-reverse flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-008-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column-reverse wrap-reverse; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001-ref.html new file mode 100644 index 0000000..2c70fa1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { margin-left: 8px } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { /* nothing special */ } + .small .alignStart { margin-left: -4px } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { /* nothing special */ } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001.html new file mode 100644 index 0000000..5143a56 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-001.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a RTL row flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-rtl-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002-ref.html new file mode 100644 index 0000000..8901d35 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002.html new file mode 100644 index 0000000..d56a25c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-rtl-002.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a RTL column flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-rtl-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001-ref.html new file mode 100644 index 0000000..64a8544 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001-ref.html
@@ -0,0 +1,98 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 8px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { /* nothing special */ } + .big .alignCenter { margin-top: 2px } + .big .alignEnd { margin-top: 4px } + .small .alignStart { /* nothing special */ } + .small .alignCenter { margin-top: -2px } + .small .alignEnd { margin-top: -4px } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001.html new file mode 100644 index 0000000..8971b4b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-001.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a vertical-rl row flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-vertWM-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002-ref.html new file mode 100644 index 0000000..3e109d0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { margin-left: 8px } + .big .alignCenter { margin-left: 4px } + .big .alignEnd { /* nothing special */ } + .small .alignStart { margin-left: -4px } + .small .alignCenter { margin-left: -2px } + .small .alignEnd { /* nothing special */ } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <br> + <!-- <content-distribution> --> + <div class="container"><div class="alignStart"><!--space-between--></div></div> + <div class="container"><div class="alignCenter"><!--space-around--></div></div> + <div class="container"><div class="alignCenter"><!--space-evenly--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <content-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <br> + <!-- <content-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002.html new file mode 100644 index 0000000..59ea153 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-vertWM-002.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a vertical-rl column flex container, with various "justify-content" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-justify-content-vertWM-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: column; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-content values, from + https://www.w3.org/TR/css-align-3/#propdef-align-content --> + <!-- normal --> + <div class="container" style="justify-content: normal"><div></div></div> + <br> + <!-- <content-distribution> --> + <div class="container" style="justify-content: space-between"><div></div></div> + <div class="container" style="justify-content: space-around"><div></div></div> + <div class="container" style="justify-content: space-evenly"><div></div></div> + <div class="container" style="justify-content: stretch"><div></div></div> + <br> + <!-- <content-position>, part 1 --> + <div class="container" style="justify-content: center"><div></div></div> + <div class="container" style="justify-content: start"><div></div></div> + <div class="container" style="justify-content: end"><div></div></div> + <br> + <!-- <content-position>, part 2 --> + <div class="container" style="justify-content: flex-start"><div></div></div> + <div class="container" style="justify-content: flex-end"><div></div></div> + <div class="container" style="justify-content: left"><div></div></div> + <div class="container" style="justify-content: right"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001-ref.html new file mode 100644 index 0000000..d4f75a03 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001-ref.html
@@ -0,0 +1,93 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001.html new file mode 100644 index 0000000..90f328e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-self-001.html
@@ -0,0 +1,97 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row flex container, with various "justify-self" values (which shouldn't have any effect) </title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-flex"> + <link rel="match" href="flex-abspos-staticpos-justify-self-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 10px; + width: 16px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001-ref.html new file mode 100644 index 0000000..428aeae6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001-ref.html
@@ -0,0 +1,79 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 10px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 14px; + width: 20px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- Margin just on one side: --> + <div class="container"><div style="margin-top: 3px"></div></div> + <div class="container"><div style="margin-right: 3px"></div></div> + <div class="container"><div style="margin-bottom: 3px"></div></div> + <div class="container"><div style="margin-left: 3px"></div></div> + <!-- Margin on all sides: --> + <div class="container"><div style="margin: 1px 2px 3px 4px"></div></div> + <br> + + <!-- "auto" margin on just one side (should be treated as 0): --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <!-- "auto" margin on all sides (should be treated as 0): --> + <div class="container"><div></div></div> + <br> + </div> + <div class="small"> + <!-- Margin just on one side: --> + <div class="container"><div style="margin-top: 3px"></div></div> + <div class="container"><div style="margin-right: 3px"></div></div> + <div class="container"><div style="margin-bottom: 3px"></div></div> + <div class="container"><div style="margin-left: 3px"></div></div> + <!-- Margin on all sides: --> + <div class="container"><div style="margin: 1px 2px 3px 4px"></div></div> + <br> + + <!-- "auto" margin on just one side (should be treated as 0): --> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <div class="container"><div></div></div> + <!-- "auto" margin on all sides (should be treated as 0): --> + <div class="container"><div></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001.html new file mode 100644 index 0000000..7a42e0de --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-001.html
@@ -0,0 +1,83 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row flex container, with various margins applied</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-margin-001-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 10px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 14px; + width: 20px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- Margin just on one side: --> + <div class="container"><div style="margin-top: 3px"></div></div> + <div class="container"><div style="margin-right: 3px"></div></div> + <div class="container"><div style="margin-bottom: 3px"></div></div> + <div class="container"><div style="margin-left: 3px"></div></div> + <!-- Margin on all sides: --> + <div class="container"><div style="margin: 1px 2px 3px 4px"></div></div> + <br> + + <!-- "auto" margin on just one side (should be treated as 0): --> + <div class="container"><div style="margin-top: auto"></div></div> + <div class="container"><div style="margin-right: auto"></div></div> + <div class="container"><div style="margin-bottom: auto"></div></div> + <div class="container"><div style="margin-left: auto"></div></div> + <!-- "auto" margin on all sides (should be treated as 0): --> + <div class="container"><div style="margin: auto"></div></div> + <br> + </div> + <div class="small"> + <!-- Margin just on one side: --> + <div class="container"><div style="margin-top: 3px"></div></div> + <div class="container"><div style="margin-right: 3px"></div></div> + <div class="container"><div style="margin-bottom: 3px"></div></div> + <div class="container"><div style="margin-left: 3px"></div></div> + <!-- Margin on all sides: --> + <div class="container"><div style="margin: 1px 2px 3px 4px"></div></div> + <br> + + <!-- "auto" margin on just one side (should be treated as 0): --> + <div class="container"><div style="margin-top: auto"></div></div> + <div class="container"><div style="margin-right: auto"></div></div> + <div class="container"><div style="margin-bottom: auto"></div></div> + <div class="container"><div style="margin-left: auto"></div></div> + <!-- "auto" margin on all sides (should be treated as 0): --> + <div class="container"><div style="margin: auto"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002-ref.html new file mode 100644 index 0000000..38cfdff0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002-ref.html
@@ -0,0 +1,79 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <meta charset="utf-8"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 10px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 14px; + width: 20px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- Margin just on one side: --> + <div class="container"><div style="margin: 3px 0 0 12px"></div></div> + <div class="container"><div style="margin: 0 0 0 9px"></div></div> + <div class="container"><div style="margin: 0 0 0 12px"></div></div> + <div class="container"><div style="margin: 0 0 0 12px"></div></div> + <!-- Margin on all sides: --> + <div class="container"><div style="margin: 1px 0 0 10px"></div></div> + <br> + + <!-- "auto" margin on just one side (should be treated as 0): --> + <div class="container"><div style="margin: 0 0 0 12px"></div></div> + <div class="container"><div style="margin: 0 0 0 12px"></div></div> + <div class="container"><div style="margin: 0 0 0 12px"></div></div> + <div class="container"><div style="margin: 0 0 0 12px"></div></div> + <!-- "auto" margin on all sides (should be treated as 0): --> + <div class="container"><div style="margin: 0 0 0 12px"></div></div> + <br> + </div> + <div class="small"> + <!-- Margin just on one side: --> + <div class="container"><div style="margin: 3px 0 0 -4px"></div></div> + <div class="container"><div style="margin: 0 0 0 -7px"></div></div> + <div class="container"><div style="margin: 0 0 0 -4px"></div></div> + <div class="container"><div style="margin: 0 0 0 -4px"></div></div> + <!-- Margin on all sides: --> + <div class="container"><div style="margin: 1px 0 0 -6px"></div></div> + <br> + + <!-- "auto" margin on just one side (should be treated as 0): --> + <div class="container"><div style="margin: 0 0 0 -4px"></div></div> + <div class="container"><div style="margin: 0 0 0 -4px"></div></div> + <div class="container"><div style="margin: 0 0 0 -4px"></div></div> + <div class="container"><div style="margin: 0 0 0 -4px"></div></div> + <!-- "auto" margin on all sides (should be treated as 0): --> + <div class="container"><div style="margin: 0 0 0 -4px"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002.html new file mode 100644 index 0000000..51b70d691 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-margin-002.html
@@ -0,0 +1,84 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <title>CSS Test: Static position of abspos children in a row flex container, with various margins applied, and "justify-content: flex-end"</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="flex-abspos-staticpos-margin-002-ref.html"> + <meta charset="utf-8"> + <style> + .container { + display: flex; + flex-flow: row; + justify-content: flex-end; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 10px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 14px; + width: 20px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- Margin just on one side: --> + <div class="container"><div style="margin-top: 3px"></div></div> + <div class="container"><div style="margin-right: 3px"></div></div> + <div class="container"><div style="margin-bottom: 3px"></div></div> + <div class="container"><div style="margin-left: 3px"></div></div> + <!-- Margin on all sides: --> + <div class="container"><div style="margin: 1px 2px 3px 4px"></div></div> + <br> + + <!-- "auto" margin on just one side (should be treated as 0): --> + <div class="container"><div style="margin-top: auto"></div></div> + <div class="container"><div style="margin-right: auto"></div></div> + <div class="container"><div style="margin-bottom: auto"></div></div> + <div class="container"><div style="margin-left: auto"></div></div> + <!-- "auto" margin on all sides (should be treated as 0): --> + <div class="container"><div style="margin: auto"></div></div> + <br> + </div> + <div class="small"> + <!-- Margin just on one side: --> + <div class="container"><div style="margin-top: 3px"></div></div> + <div class="container"><div style="margin-right: 3px"></div></div> + <div class="container"><div style="margin-bottom: 3px"></div></div> + <div class="container"><div style="margin-left: 3px"></div></div> + <!-- Margin on all sides: --> + <div class="container"><div style="margin: 1px 2px 3px 4px"></div></div> + <br> + + <!-- "auto" margin on just one side (should be treated as 0): --> + <div class="container"><div style="margin-top: auto"></div></div> + <div class="container"><div style="margin-right: auto"></div></div> + <div class="container"><div style="margin-bottom: auto"></div></div> + <div class="container"><div style="margin-left: auto"></div></div> + <!-- "auto" margin on all sides (should be treated as 0): --> + <div class="container"><div style="margin: auto"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001-ref.html new file mode 100644 index 0000000..36b570f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001-ref.html
@@ -0,0 +1,96 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + margin-left: 3px; + } + .big .alignStart { margin-top: 2px; } + .big .alignCenter { margin-top: 9px; } + .big .alignEnd { margin-top: 16px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -2px; } + .small .alignEnd { margin-top: -4px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001.html new file mode 100644 index 0000000..191d6b8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-001.html
@@ -0,0 +1,97 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-001-ref.html"> + <style> + .container { + display: grid; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + position: relative; + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002-ref.html new file mode 100644 index 0000000..40dd0f2f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002-ref.html
@@ -0,0 +1,95 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big .alignStart { margin-top: 0px; } + .big .alignCenter { margin-top: 13px; } + .big .alignEnd { margin-top: 26px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -1px; } + .small .alignEnd { margin-top: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002.html new file mode 100644 index 0000000..b9ee727 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-002.html
@@ -0,0 +1,96 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a static-pos grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-002-ref.html"> + <style> + .container { + display: grid; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + align-items: center; /* To exercise 'align-self: auto' on children */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001-ref.html new file mode 100644 index 0000000..a14d630 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001-ref.html
@@ -0,0 +1,127 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 40px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + margin-bottom: 20px; /* to reduce overlap between overflowing images */ + } + + .container > * { + margin-left: 3px; + display: block; + } + .big .alignStart { margin-top: 2px; } + .big .alignCenter { margin-top: 9px; } + .big .alignEnd { margin-top: 16px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -7px; } + .small .alignEnd { margin-top: -14px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--auto--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--normal--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--stretch--></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--baseline--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--last baseline--></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignCenter"><!--center--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--self-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--self-end--></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--flex-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--flex-end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--left--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--right--></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--auto--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--normal--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--stretch--></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--baseline--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--last baseline--></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignCenter"><!--center--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--self-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--self-end--></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--flex-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--flex-end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--left--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--right--></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001.html new file mode 100644 index 0000000..fa4a56d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-001.html
@@ -0,0 +1,126 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos replaced children in a grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-img-001-ref.html"> + <style> + .container { + display: grid; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + height: 40px; + width: 22px; + grid: 2px 30px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + height: 2px; + width: 4px; + margin-bottom: 20px; /* to reduce overlap between overflowing images */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: auto"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: normal"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: stretch"></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: baseline"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: last baseline"></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: center"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: self-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: self-end"></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: flex-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: flex-end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: left"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: right"></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: auto"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: normal"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: stretch"></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: baseline"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: last baseline"></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: center"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: self-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: self-end"></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: flex-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: flex-end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: left"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: right"></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002-ref.html new file mode 100644 index 0000000..ea15f8de --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002-ref.html
@@ -0,0 +1,126 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 40px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + margin-bottom: 20px; /* to reduce overlap between overflowing images */ + } + + .container > * { + display: block; + } + .big .alignStart { margin-top: 0px; } + .big .alignCenter { margin-top: 13px; } + .big .alignEnd { margin-top: 26px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -6px; } + .small .alignEnd { margin-top: -12px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--auto--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--normal--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--stretch--></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--baseline--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--last baseline--></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignCenter"><!--center--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--self-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--self-end--></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--flex-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--flex-end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--left--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--right--></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--auto--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--normal--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--stretch--></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--baseline--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--last baseline--></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignCenter"><!--center--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--self-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--self-end--></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--flex-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--flex-end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--left--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--right--></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002.html new file mode 100644 index 0000000..5fca4c3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-img-002.html
@@ -0,0 +1,125 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos replaced children in a static-pos grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-img-002-ref.html"> + <style> + .container { + display: grid; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 40px; + width: 22px; + grid: 2px 30px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + height: 2px; + width: 4px; + margin-bottom: 20px; /* to reduce overlap between overflowing images */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: auto"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: normal"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: stretch"></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: baseline"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: last baseline"></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: center"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: self-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: self-end"></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: flex-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: flex-end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: left"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: right"></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: auto"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: normal"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: stretch"></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: baseline"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: last baseline"></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: center"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: self-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: self-end"></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: flex-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: flex-end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: left"></div> + <div class="container"><img src="support/colors-8x16.png" + style="align-self: right"></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001-ref.html new file mode 100644 index 0000000..671b315 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 11px; } + .small > .container > * { margin-left: -7px; } + + .big .alignStart { margin-top: 2px; } + .big .alignCenter { margin-top: 9px; } + .big .alignEnd { margin-top: 16px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -2px; } + .small .alignEnd { margin-top: -4px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001.html new file mode 100644 index 0000000..1e7a125 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-001.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a RTL grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-rtl-001-ref.html"> + <style> + .container { + display: grid; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002-ref.html new file mode 100644 index 0000000..671b315 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 11px; } + .small > .container > * { margin-left: -7px; } + + .big .alignStart { margin-top: 2px; } + .big .alignCenter { margin-top: 9px; } + .big .alignEnd { margin-top: 16px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -2px; } + .small .alignEnd { margin-top: -4px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002.html new file mode 100644 index 0000000..7274c11 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-002.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos LTR children in a RTL grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-rtl-002-ref.html"> + <style> + .container { + display: grid; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + direction: ltr; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003-ref.html new file mode 100644 index 0000000..cadaadd --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 14px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { margin-top: 0px; } + .big .alignCenter { margin-top: 13px; } + .big .alignEnd { margin-top: 26px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -1px; } + .small .alignEnd { margin-top: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003.html new file mode 100644 index 0000000..f8539f8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-003.html
@@ -0,0 +1,100 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a RTL static-pos grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-rtl-003-ref.html"> + <style> + .container { + display: grid; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004-ref.html new file mode 100644 index 0000000..cadaadd --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 14px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { margin-top: 0px; } + .big .alignCenter { margin-top: 13px; } + .big .alignEnd { margin-top: 26px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -1px; } + .small .alignEnd { margin-top: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004.html new file mode 100644 index 0000000..b891d541 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-rtl-004.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos LTR children in a RTL static-pos grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-rtl-004-ref.html"> + <style> + .container { + display: grid; + direction: rtl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + direction: ltr; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001-ref.html new file mode 100644 index 0000000..5e7fd9f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001-ref.html
@@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>Reference: Testing safe overflow-position for align-self and justify-self in absolutely positioned boxes in grid containers in both horizontal and vertical writing modes</title> + <link rel="author" title="Mihir Iyer" href="mailto:miyer@mozilla.com"> + <style> + .container { + display: grid; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + width: 30px; + height: 25px; + grid: 3px 14px 3px / 2px 20px 2px; + } + br { clear: both } + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 21px; + height: 21px; + justify-self: start; + align-self: start; + } + .vertRL { + writing-mode: vertical-rl; + } + .relPos { + position: relative; + } + .relPos > * { + height: 35px; + width: 33px; + } + </style> +</head> +<body> + <div class="container vertRL"><div></div></div> + <div class="container"><div></div></div> + <div class="container relPos vertRL"><div></div></div> + <div class="container relPos"><div></div></div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001.html new file mode 100644 index 0000000..f8cfa79 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-safe-001.html
@@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Testing safe overflow-position for align-self and justify-self in absolutely positioned boxes in grid containers in both horizontal and vertical writing modes</title> + <link rel="author" title="Mihir Iyer" href="mailto:miyer@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#overflow-values"> + <link rel="match" href="grid-abspos-staticpos-align-self-safe-001-ref.html"> + <style> + .container { + display: grid; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + width: 30px; + height: 25px; + grid: 3px 14px 3px / 2px 20px 2px; + } + br { clear: both } + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 21px; + height: 21px; + justify-self: safe end; + align-self: safe center; + } + .vertRL { + writing-mode: vertical-rl; + } + .relPos { + position: relative; + } + .relPos > * { + height: 35px; + width: 33px; + } + </style> +</head> +<body> + <div class="container vertRL"><div></div></div> + <div class="container"><div></div></div> + <div class="container relPos vertRL"><div></div></div> + <div class="container relPos"><div></div></div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001-ref.html new file mode 100644 index 0000000..37575f0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001-ref.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + margin-top: 3px; + } + .big .alignStart { margin-left: 22px; } + .big .alignCenter { margin-left: 15px; } + .big .alignEnd { margin-left: 8px; } + .small .alignStart { margin-left: -4px; } + .small .alignCenter { margin-left: -2px; } + .small .alignEnd { margin-left: 0px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001.html new file mode 100644 index 0000000..273abb1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-001.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a vertical-rl grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-vertWM-001-ref.html"> + <style> + .container { + display: grid; + writing-mode: vertical-rl; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002-ref.html new file mode 100644 index 0000000..ce217e7f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002-ref.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + margin-top: 3px; + } + .big .alignStart { margin-left: 22px; } + .big .alignCenter { margin-left: 15px; } + .big .alignEnd { margin-left: 8px; } + .small .alignStart { margin-left: -4px; } + .small .alignCenter { margin-left: -2px; } + .small .alignEnd { margin-left: 0px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002.html new file mode 100644 index 0000000..2156f4b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-002.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos horizontal-tb children in a vertical-rl grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-vertWM-002-ref.html"> + <style> + .container { + display: grid; + writing-mode: vertical-rl; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + writing-mode: horizontal-tb; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003-ref.html new file mode 100644 index 0000000..7eca626 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003-ref.html
@@ -0,0 +1,100 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + } + .big .alignStart { margin-left: 24px; } + .big .alignCenter { margin-left: 11px; } + .big .alignEnd { margin-left: -2px; } + .small .alignStart { margin-left: -4px; } + .small .alignCenter { margin-left: -3px; } + .small .alignEnd { margin-left: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003.html new file mode 100644 index 0000000..b727d3b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-003.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a vertical-rl static-pos grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-vertWM-003-ref.html"> + <style> + .container { + display: grid; + writing-mode: vertical-rl; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004-ref.html new file mode 100644 index 0000000..66d0d29 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004-ref.html
@@ -0,0 +1,100 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + } + .big .alignStart { margin-left: 24px; } + .big .alignCenter { margin-left: 11px; } + .big .alignEnd { margin-left: -2px; } + .small .alignStart { margin-left: -4px; } + .small .alignCenter { margin-left: -3px; } + .small .alignEnd { margin-left: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004.html new file mode 100644 index 0000000..f350ef8c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-align-self-vertWM-004.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos horizontal-tb children in a static-pos vertical-rl grid container, with various "align-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-align-self-vertWM-004-ref.html"> + <style> + .container { + display: grid; + writing-mode: vertical-rl; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 2px 20px 2px / 3px 14px 3px; + } + .small > .container { + grid: 0px 2px 0px / 3px 2px 3px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + writing-mode: horizontal-tb; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various align-self values, from + https://www.w3.org/TR/css-align-3/#propdef-align-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="align-self: auto"></div></div> + <div class="container"><div style="align-self: normal"></div></div> + <div class="container"><div style="align-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="align-self: baseline"></div></div> + <div class="container"><div style="align-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="align-self: center"></div></div> + <div class="container"><div style="align-self: start"></div></div> + <div class="container"><div style="align-self: end"></div></div> + <div class="container"><div style="align-self: self-start"></div></div> + <div class="container"><div style="align-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="align-self: flex-start"></div></div> + <div class="container"><div style="align-self: flex-end"></div></div> + <div class="container"><div style="align-self: left"></div></div> + <div class="container"><div style="align-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001-ref.html new file mode 100644 index 0000000..6d197e4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001-ref.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + margin-top: 3px; + } + .big .alignStart { margin-left: 2px; } + .big .alignCenter { margin-left: 9px; } + .big .alignEnd { margin-left: 16px; } + .small .alignStart { margin-left: 0px; } + .small .alignCenter { margin-left: -2px; } + .small .alignEnd { margin-left: -4px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001.html new file mode 100644 index 0000000..99cfcbb9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-001.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-001-ref.html"> + <style> + .container { + display: grid; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + justify-items: center; /* To exercise 'justify-self: auto' on children */ + position: relative; + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002-ref.html new file mode 100644 index 0000000..f7396ed --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002-ref.html
@@ -0,0 +1,100 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + } + .big .alignStart { margin-left: 0px; } + .big .alignCenter { margin-left: 13px; } + .big .alignEnd { margin-left: 26px; } + .small .alignStart { margin-left: 0px; } + .small .alignCenter { margin-left: -1px; } + .small .alignEnd { margin-left: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignCenter"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002.html new file mode 100644 index 0000000..b82d308 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-002.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a static-pos grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-002-ref.html"> + <style> + .container { + display: grid; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + justify-items: center; /* To exercise 'justify-self: auto' on children */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001-ref.html new file mode 100644 index 0000000..78d62121 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001-ref.html
@@ -0,0 +1,127 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 40px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-bottom: 20px; /* to reduce overlap between overflowing images */ + } + + .container > * { + margin-top: 3px; + display: block; + } + .big .alignStart { margin-left: 2px; } + .big .alignCenter { margin-left: 13px; } + .big .alignEnd { margin-left: 24px; } + .small .alignStart { margin-left: 0px; } + .small .alignCenter { margin-left: -3px; } + .small .alignEnd { margin-left: -6px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--auto--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--normal--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--stretch--></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--baseline--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--last baseline--></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignCenter"><!--center--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--self-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--self-end--></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--flex-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--flex-end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--left--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--right--></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--auto--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--normal--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--stretch--></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--baseline--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--last baseline--></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignCenter"><!--center--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--self-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--self-end--></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--flex-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--flex-end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--left--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--right--></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001.html new file mode 100644 index 0000000..fdd4f62 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-001.html
@@ -0,0 +1,126 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos replaced children in a grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-img-001-ref.html"> + <style> + .container { + display: grid; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + width: 40px; + height: 22px; + grid: 3px 14px 3px / 2px 30px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + width: 2px; + height: 4px; + margin-bottom: 20px; /* to reduce overlap between overflowing images */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: auto"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: normal"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: stretch"></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: baseline"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: last baseline"></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: center"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: self-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: self-end"></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: flex-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: flex-end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: left"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: right"></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: auto"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: normal"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: stretch"></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: baseline"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: last baseline"></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: center"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: self-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: self-end"></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: flex-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: flex-end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: left"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: right"></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002-ref.html new file mode 100644 index 0000000..e71555d4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002-ref.html
@@ -0,0 +1,126 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 40px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-bottom: 20px; /* to reduce overlap between overflowing images */ + } + + .container > * { + display: block; + } + .big .alignStart { margin-left: 0px; } + .big .alignCenter { margin-left: 17px; } + .big .alignEnd { margin-left: 34px; } + .small .alignStart { margin-left: 0px; } + .small .alignCenter { margin-left: -2px; } + .small .alignEnd { margin-left: -4px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--auto--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--normal--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--stretch--></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--baseline--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--last baseline--></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignCenter"><!--center--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--self-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--self-end--></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--flex-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--flex-end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--left--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--right--></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--auto--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--normal--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--stretch--></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--baseline--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--last baseline--></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignCenter"><!--center--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--self-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--self-end--></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--flex-start--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--flex-end--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignStart"><!--left--></div> + <div class="container"><img src="support/colors-8x16.png" + class="alignEnd"><!--right--></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002.html new file mode 100644 index 0000000..61c1b97b5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-img-002.html
@@ -0,0 +1,125 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos replaced children in a static-pos grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-img-002-ref.html"> + <style> + .container { + display: grid; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 40px; + height: 22px; + grid: 3px 14px 3px / 2px 30px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + width: 2px; + height: 4px; + margin-bottom: 20px; /* to reduce overlap between overflowing images */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: auto"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: normal"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: stretch"></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: baseline"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: last baseline"></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: center"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: self-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: self-end"></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: flex-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: flex-end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: left"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: right"></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: auto"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: normal"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: stretch"></div> + <br> + <!-- <baseline-position> --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: baseline"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: last baseline"></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: center"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: self-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: self-end"></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: flex-start"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: flex-end"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: left"></div> + <div class="container"><img src="support/colors-8x16.png" + style="justify-self: right"></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001-ref.html new file mode 100644 index 0000000..8e5db1e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001-ref.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + margin-top: 3px; + } + .big .alignStart { margin-left: 22px; } + .big .alignCenter { margin-left: 15px; } + .big .alignEnd { margin-left: 8px; } + .small .alignStart { margin-left: -4px; } + .small .alignCenter { margin-left: -2px; } + .small .alignEnd { margin-left: 0px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001.html new file mode 100644 index 0000000..18e024bf --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-001.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a RTL grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-rtl-001-ref.html"> + <style> + .container { + display: grid; + direction: rtl; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002-ref.html new file mode 100644 index 0000000..c7176a7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002-ref.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + margin-top: 3px; + } + .big .alignStart { margin-left: 22px; } + .big .alignCenter { margin-left: 15px; } + .big .alignEnd { margin-left: 8px; } + .small .alignStart { margin-left: -4px; } + .small .alignCenter { margin-left: -2px; } + .small .alignEnd { margin-left: 0px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002.html new file mode 100644 index 0000000..d7e510e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-002.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos LTR children in a RTL grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-rtl-002-ref.html"> + <style> + .container { + display: grid; + direction: rtl; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + direction: ltr; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003-ref.html new file mode 100644 index 0000000..8c88ad97b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003-ref.html
@@ -0,0 +1,100 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + } + .big .alignStart { margin-left: 24px; } + .big .alignCenter { margin-left: 11px; } + .big .alignEnd { margin-left: -2px; } + .small .alignStart { margin-left: -4px; } + .small .alignCenter { margin-left: -3px; } + .small .alignEnd { margin-left: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003.html new file mode 100644 index 0000000..2224ff6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-003.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a RTL static-pos grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-rtl-003-ref.html"> + <style> + .container { + display: grid; + direction: rtl; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004-ref.html new file mode 100644 index 0000000..3e4c100 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004-ref.html
@@ -0,0 +1,100 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + } + .small > .container { + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + background: teal; + width: 6px; + height: 8px; + } + .big .alignStart { margin-left: 24px; } + .big .alignCenter { margin-left: 11px; } + .big .alignEnd { margin-left: -2px; } + .small .alignStart { margin-left: -4px; } + .small .alignCenter { margin-left: -3px; } + .small .alignEnd { margin-left: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignEnd"><!--self-start--></div></div> + <div class="container"><div class="alignStart"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignEnd"><!--left--></div></div> + <div class="container"><div class="alignStart"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004.html new file mode 100644 index 0000000..a22fdc24 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-rtl-004.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos LTR children in a RTL static-pos grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-rtl-004-ref.html"> + <style> + .container { + display: grid; + direction: rtl; + padding: 2px 1px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + width: 30px; + height: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + width: 2px; + height: 4px; + margin-right: 10px; /* To avoid overlap between overflowing kids */ + } + + .container > * { + position: absolute; + direction: ltr; + grid-area: 2 / 2 / 3 / 3; + background: teal; + width: 6px; + height: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001-ref.html new file mode 100644 index 0000000..9fff3eab --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001-ref.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + margin-top: 3px; + } + .big > .container > * { margin-left: 11px; } + .small > .container > * { margin-left: -7px; } + + .big .alignStart { margin-top: 2px; } + .big .alignCenter { margin-top: 9px; } + .big .alignEnd { margin-top: 16px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -2px; } + .small .alignEnd { margin-top: -4px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001.html new file mode 100644 index 0000000..1bc2a5c3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-001.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a vertical-rl grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-vertWM-001-ref.html"> + <style> + .container { + display: grid; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002-ref.html new file mode 100644 index 0000000..9fff3eab --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002-ref.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + margin-top: 3px; + } + .big > .container > * { margin-left: 11px; } + .small > .container > * { margin-left: -7px; } + + .big .alignStart { margin-top: 2px; } + .big .alignCenter { margin-top: 9px; } + .big .alignEnd { margin-top: 16px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -2px; } + .small .alignEnd { margin-top: -4px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002.html new file mode 100644 index 0000000..7b72c6a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-002.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos horizontal-tb children in a vertical-rl grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-vertWM-002-ref.html"> + <style> + .container { + display: grid; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + position: relative; + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + writing-mode: horizontal-tb; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003-ref.html new file mode 100644 index 0000000..c0d0b78 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 14px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { margin-top: 0px; } + .big .alignCenter { margin-top: 13px; } + .big .alignEnd { margin-top: 26px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -1px; } + .small .alignEnd { margin-top: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003.html new file mode 100644 index 0000000..582262bd --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-003.html
@@ -0,0 +1,100 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos children in a vertical-rl static-pos grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-vertWM-003-ref.html"> + <style> + .container { + display: grid; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004-ref.html new file mode 100644 index 0000000..c0d0b78 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004-ref.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .container { + display: block; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + } + .small > .container { + height: 2px; + width: 4px; + } + + .container > * { + background: teal; + height: 6px; + width: 8px; + } + .big > .container > * { margin-left: 14px; } + .small > .container > * { margin-left: -4px; } + + .big .alignStart { margin-top: 0px; } + .big .alignCenter { margin-top: 13px; } + .big .alignEnd { margin-top: 26px; } + .small .alignStart { margin-top: 0px; } + .small .alignCenter { margin-top: -1px; } + .small .alignEnd { margin-top: -2px; } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div class="alignStart"><!--auto--></div></div> + <div class="container"><div class="alignStart"><!--normal--></div></div> + <div class="container"><div class="alignStart"><!--stretch--></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div class="alignStart"><!--baseline--></div></div> + <div class="container"><div class="alignEnd"><!--last baseline--></div></div> + <br> + <!-- <self-position>, part 1: --> + <div class="container"><div class="alignCenter"><!--center--></div></div> + <div class="container"><div class="alignStart"><!--start--></div></div> + <div class="container"><div class="alignEnd"><!--end--></div></div> + <div class="container"><div class="alignStart"><!--self-start--></div></div> + <div class="container"><div class="alignEnd"><!--self-end--></div></div> + <br> + <!-- <self-position>, part 2: --> + <div class="container"><div class="alignStart"><!--flex-start--></div></div> + <div class="container"><div class="alignEnd"><!--flex-end--></div></div> + <div class="container"><div class="alignStart"><!--left--></div></div> + <div class="container"><div class="alignEnd"><!--right--></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004.html new file mode 100644 index 0000000..63c893b6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/grid-abspos-staticpos-justify-self-vertWM-004.html
@@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> +<head> + <meta charset="utf-8"> + <title>CSS Test: Static position of abspos horizontal-tb children in a vertical-rl static-pos grid container, with various "justify-self" values</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos-static"> + <link rel="match" href="grid-abspos-staticpos-justify-self-vertWM-004-ref.html"> + <style> + .container { + display: grid; + writing-mode: vertical-rl; + padding: 1px 2px; + border: 1px solid black; + background: yellow; + margin-bottom: 5px; + margin-right: 5px; + float: left; /* For testing in "rows" of containers */ + } + br { clear: both } + + .big > .container { + height: 30px; + width: 22px; + grid: 3px 14px 3px / 2px 20px 2px; + } + .small > .container { + grid: 3px 2px 3px / 0px 2px 0px; + height: 2px; + width: 4px; + } + + .container > * { + position: absolute; + writing-mode: horizontal-tb; + grid-area: 2 / 2 / 3 / 3; + background: teal; + height: 6px; + width: 8px; + } + </style> +</head> +<body> + <div class="big"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> + <div class="small"> + <!-- The various justify-self values, from + https://www.w3.org/TR/css-align-3/#propdef-justify-self --> + <!-- auto | normal | stretch --> + <div class="container"><div style="justify-self: auto"></div></div> + <div class="container"><div style="justify-self: normal"></div></div> + <div class="container"><div style="justify-self: stretch"></div></div> + <br> + <!-- <baseline-position> --> + <div class="container"><div style="justify-self: baseline"></div></div> + <div class="container"><div style="justify-self: last baseline"></div></div> + <br> + <!-- <self-position>, part 1 --> + <div class="container"><div style="justify-self: center"></div></div> + <div class="container"><div style="justify-self: start"></div></div> + <div class="container"><div style="justify-self: end"></div></div> + <div class="container"><div style="justify-self: self-start"></div></div> + <div class="container"><div style="justify-self: self-end"></div></div> + <br> + <!-- <self-position>, part 2 --> + <div class="container"><div style="justify-self: flex-start"></div></div> + <div class="container"><div style="justify-self: flex-end"></div></div> + <div class="container"><div style="justify-self: left"></div></div> + <div class="container"><div style="justify-self: right"></div></div> + <br> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/support/colors-8x16.png b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/support/colors-8x16.png new file mode 100644 index 0000000..596fdb3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/support/colors-8x16.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any-expected.txt deleted file mode 100644 index 86adede7..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -This is a testharness.js-based test. -FAIL Constructing a Response with a stream on which getReader() is called assert_throws: function "() => new Response(stream)" did not throw -FAIL Constructing a Response with a stream on which read() is called assert_throws: function "() => new Response(stream)" did not throw -FAIL Constructing a Response with a stream on which read() and releaseLock() are called assert_throws: function "() => new Response(stream)" did not throw -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any.serviceworker-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any.serviceworker-expected.txt deleted file mode 100644 index 86adede7..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any.serviceworker-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -This is a testharness.js-based test. -FAIL Constructing a Response with a stream on which getReader() is called assert_throws: function "() => new Response(stream)" did not throw -FAIL Constructing a Response with a stream on which read() is called assert_throws: function "() => new Response(stream)" did not throw -FAIL Constructing a Response with a stream on which read() and releaseLock() are called assert_throws: function "() => new Response(stream)" did not throw -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any.sharedworker-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any.sharedworker-expected.txt deleted file mode 100644 index 86adede7..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any.sharedworker-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -This is a testharness.js-based test. -FAIL Constructing a Response with a stream on which getReader() is called assert_throws: function "() => new Response(stream)" did not throw -FAIL Constructing a Response with a stream on which read() is called assert_throws: function "() => new Response(stream)" did not throw -FAIL Constructing a Response with a stream on which read() and releaseLock() are called assert_throws: function "() => new Response(stream)" did not throw -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any.worker-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any.worker-expected.txt deleted file mode 100644 index 86adede7..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-from-stream.any.worker-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -This is a testharness.js-based test. -FAIL Constructing a Response with a stream on which getReader() is called assert_throws: function "() => new Response(stream)" did not throw -FAIL Constructing a Response with a stream on which read() is called assert_throws: function "() => new Response(stream)" did not throw -FAIL Constructing a Response with a stream on which read() and releaseLock() are called assert_throws: function "() => new Response(stream)" did not throw -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size-expected.txt new file mode 100644 index 0000000..ed26217 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size-expected.txt
@@ -0,0 +1,12 @@ +This is a testharness.js-based test. +PASS rendered legend (writing-mode: horizontal-tb) +FAIL second legend (writing-mode: horizontal-tb) assert_equals: expected "30px" but got "100px" +FAIL div (writing-mode: horizontal-tb) assert_equals: expected "30px" but got "100px" +PASS rendered legend (writing-mode: vertical-lr) +FAIL second legend (writing-mode: vertical-lr) assert_equals: expected "30px" but got "100px" +FAIL div (writing-mode: vertical-lr) assert_equals: expected "30px" but got "100px" +PASS rendered legend (writing-mode: vertical-rl) +FAIL second legend (writing-mode: vertical-rl) assert_equals: expected "30px" but got "100px" +FAIL div (writing-mode: vertical-rl) assert_equals: expected "30px" but got "100px" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size.html new file mode 100644 index 0000000..1c221555 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size.html
@@ -0,0 +1,45 @@ +<!doctype html> +<title>fieldset percentage block size</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<style> + fieldset { block-size: 100px; margin: 20px; padding: 0; border: 10px solid; } + .rendered-legend { block-size: 80%; background: lime; padding: 0; } + .second-legend { block-size: 100%; background: yellow; padding: 0; } + fieldset > div { block-size: 100%; background: fuchsia; } +</style> +<div style="writing-mode: horizontal-tb"> + <fieldset> + <legend class="rendered-legend">rendered legend</legend> + <legend class="second-legend">second legend</legend> + <div>div</div> + </fieldset> +</div> + +<div style="writing-mode: vertical-lr"> + <fieldset> + <legend class="rendered-legend">rendered legend</legend> + <legend class="second-legend">second legend</legend> + <div>div</div> + </fieldset> +</div> + +<div style="writing-mode: vertical-rl"> + <fieldset> + <legend class="rendered-legend">rendered legend</legend> + <legend class="second-legend">second legend</legend> + <div>div</div> + </fieldset> +</div> + +<script> + for (const div of document.querySelectorAll('div[style]')) { + for (const el of div.firstElementChild.children) { + test(() => { + const expected = el.textContent === 'rendered legend' ? '80px' : '30px'; + // 30px because: 100px - (max(0, legend-block-size - border-block-start)) + assert_equals(getComputedStyle(el).blockSize, expected); + }, `${el.textContent} (${div.getAttribute('style')})`); + } + } +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self-expected.txt new file mode 100644 index 0000000..784705b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self-expected.txt
@@ -0,0 +1,16 @@ +This is a testharness.js-based test. +PASS <fieldset><legend>x</legend></fieldset> +FAIL <fieldset><legend align="left">x</legend></fieldset> assert_equals: expected "left" but got "auto" +FAIL <fieldset><legend align="center">x</legend></fieldset> assert_equals: expected "center" but got "auto" +FAIL <fieldset><legend align="right">x</legend></fieldset> assert_equals: expected "right" but got "auto" +FAIL <fieldset><legend align="lEfT">x</legend></fieldset> assert_equals: expected "left" but got "auto" +FAIL <fieldset><legend align="cEnTeR">x</legend></fieldset> assert_equals: expected "center" but got "auto" +FAIL <fieldset><legend align="rIgHt">x</legend></fieldset> assert_equals: expected "right" but got "auto" +PASS <fieldset><legend align="justify">x</legend></fieldset> +PASS <fieldset><legend align="left ">x</legend></fieldset> +PASS <fieldset><legend dir="ltr">x</legend></fieldset> +PASS <fieldset><legend dir="rtl">x</legend></fieldset> +PASS <fieldset dir="rtl"><legend dir="ltr">x</legend></fieldset> +PASS <fieldset dir="rtl"><legend dir="rtl">x</legend></fieldset> +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self.html new file mode 100644 index 0000000..29df29d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self.html
@@ -0,0 +1,34 @@ +<!doctype html> +<title>legend align to justify-self</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<fieldset><legend>x</legend></fieldset> +<fieldset><legend align=left>x</legend></fieldset> +<fieldset><legend align=center>x</legend></fieldset> +<fieldset><legend align=right>x</legend></fieldset> +<fieldset><legend align=lEfT>x</legend></fieldset> +<fieldset><legend align=cEnTeR>x</legend></fieldset> +<fieldset><legend align=rIgHt>x</legend></fieldset> +<!-- invalid values --> +<fieldset><legend align=justify>x</legend></fieldset> +<fieldset><legend align="left ">x</legend></fieldset> +<!-- dir --> +<fieldset><legend dir=ltr>x</legend></fieldset> +<fieldset><legend dir=rtl>x</legend></fieldset> +<fieldset dir=rtl><legend dir=ltr>x</legend></fieldset> +<fieldset dir=rtl><legend dir=rtl>x</legend></fieldset> +<script> +for (const fieldset of document.querySelectorAll('fieldset')) { + test(() => { + const legend = fieldset.firstChild; + const align = legend.align.toLowerCase(); + let expected = 'auto'; + switch (align) { + case 'left': expected = 'left'; break; + case 'center': expected = 'center'; break; + case 'right': expected = 'right'; break; + } + assert_equals(getComputedStyle(legend).justifySelf, expected); + }, `${fieldset.outerHTML}`) +} +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins-ref.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins-ref.html new file mode 100644 index 0000000..f2701d26 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins-ref.html
@@ -0,0 +1,13 @@ +<!doctype html> +<title>Reference for legend block margins</title> +<style> +body { margin: 0; } +.fieldset { margin: 2em 1em 1em 1em; border: 1em solid green; } +.legend { position: absolute; margin-top: -1em; margin-left: 1em; background: white; height: 1em; } +.inner { margin: 3em 1em 1em 1em; height: 1em; } +</style> +<p>There should be no red.</p> +<div class=fieldset> + <div class=legend>X</div> + <div class=inner>Y</div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins.html new file mode 100644 index 0000000..98cd16c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins.html
@@ -0,0 +1,16 @@ +<!doctype html> +<title>legend block margins</title> +<link rel=match href=legend-block-margins-ref.html> +<style> + body { margin: 0; } + fieldset { margin: 1em; border: 1em solid green; padding: 0; background: white; } + legend { margin: 1em 1em 2em 1em; height: 1em; padding: 0; } + .inner { margin: 1em; height: 1em; } + .behind { position: absolute; left: 1em; right: 1em; margin-top: 1em; height: 7em; background: red; z-index: -1; } +</style> +<p>There should be no red.</p> +<div class=behind></div> +<fieldset> + <legend>X</legend> + <div class=inner>Y</div> +</fieldset>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-expected.txt index f9a02c9..d13c68ba 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. PASS rendered legend with display: block -FAIL rendered legend with display: table assert_equals: display: table is not supported expected "table" but got "block" +PASS rendered legend with display: table FAIL rendered legend with display: table-row-group assert_equals: display: table-row-group is not supported expected "table-row-group" but got "block" FAIL rendered legend with display: table-header-group assert_equals: display: table-header-group is not supported expected "table-header-group" but got "block" FAIL rendered legend with display: table-footer-group assert_equals: display: table-footer-group is not supported expected "table-footer-group" but got "block" @@ -9,21 +9,21 @@ FAIL rendered legend with display: table-column-group assert_equals: display: table-column-group is not supported expected "table-column-group" but got "block" FAIL rendered legend with display: table-column assert_equals: display: table-column is not supported expected "table-column" but got "block" FAIL rendered legend with display: table-caption assert_equals: display: table-caption is not supported expected "table-caption" but got "block" -FAIL rendered legend with display: list-item assert_equals: display: list-item is not supported expected "list-item" but got "block" +PASS rendered legend with display: list-item FAIL rendered legend with display: flow assert_equals: display: flow is not supported expected "flow" but got "block" -FAIL rendered legend with display: flow-root assert_equals: display: flow-root is not supported expected "flow-root" but got "block" +PASS rendered legend with display: flow-root FAIL rendered legend with display: run-in assert_equals: display: run-in is not supported expected "run-in" but got "block" FAIL rendered legend with display: inline assert_equals: display: inline is not supported expected "inline" but got "block" FAIL rendered legend with display: inline-block assert_equals: display: inline-block is not supported expected "inline-block" but got "block" -FAIL rendered legend with display: inline-table assert_equals: display: inline-table is not supported expected "inline-table" but got "block" +FAIL rendered legend with display: inline-table assert_equals: display: inline-table is not supported expected "inline-table" but got "table" FAIL rendered legend with display: ruby assert_equals: display: ruby is not supported expected "ruby" but got "block" FAIL rendered legend with display: ruby-base assert_equals: display: ruby-base is not supported expected "ruby-base" but got "block" FAIL rendered legend with display: ruby-text assert_equals: display: ruby-text is not supported expected "ruby-text" but got "block" FAIL rendered legend with display: ruby-base-container assert_equals: display: ruby-base-container is not supported expected "ruby-base-container" but got "block" FAIL rendered legend with display: ruby-text-container assert_equals: display: ruby-text-container is not supported expected "ruby-text-container" but got "block" -FAIL rendered legend with display: grid assert_equals: display: grid is not supported expected "grid" but got "block" -FAIL rendered legend with display: inline-grid assert_equals: display: inline-grid is not supported expected "inline-grid" but got "block" -FAIL rendered legend with display: flex assert_equals: display: flex is not supported expected "flex" but got "block" -FAIL rendered legend with display: inline-flex assert_equals: display: inline-flex is not supported expected "inline-flex" but got "block" +PASS rendered legend with display: grid +FAIL rendered legend with display: inline-grid assert_equals: display: inline-grid is not supported expected "inline-grid" but got "grid" +PASS rendered legend with display: flex +FAIL rendered legend with display: inline-flex assert_equals: display: inline-flex is not supported expected "inline-flex" but got "flex" Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering-ref.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering-ref.html new file mode 100644 index 0000000..189b195f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering-ref.html
@@ -0,0 +1,34 @@ +<!doctype html> +<title>Reference for rendered legend and CSS display rendering</title> +<style> +body { margin: 0; } +div { width: 600px; box-sizing: border-box; background: #ddd; border: 1px solid; } +.padding { padding-left: 5em; } +.margin { margin-left: 5em; } +.cell { display: inline-block; width: 50%; } +.ruby { display: block; } +</style> +<div><span class=cell>table</span><span class=cell>table</span></div> +<div class=padding>table-row-group</div> +<div class=padding>table-header-group</div> +<div class=padding>table-footer-group</div> +<div class=padding>table-row</div> +<div class=margin>table-cell</div> +<div class=padding>table-column-group</div> +<div class=padding>table-column</div> +<div>table-caption</div> +<div>flow</div> +<div>flow-root</div> +<div>run-in</div> +<div>inline</div> +<div>inline-block</div> +<div><span class=cell>inline-table</span><span class=cell>inline-table</span></div> +<div><span class=ruby>ruby</span><span class=ruby>ruby</span></div> +<div>ruby-base</div> +<div>ruby-text</div> +<div>ruby-base-container</div> +<div>ruby-text-container</div> +<div><span class=cell>grid</span><span class=cell>grid</span></div> +<div><span class=cell>inline-grid</span><span class=cell>inline-grid</span></div> +<div><span class=cell>flex</span><span class=cell>flex</span></div> +<div><span class=cell>inline-flex</span><span class=cell>inline-flex</span></div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering.html new file mode 100644 index 0000000..ba661050 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering.html
@@ -0,0 +1,119 @@ +<!doctype html> +<title>rendered legend and CSS display rendering</title> +<link rel=match href=legend-display-rendering-ref.html> +<style> +body { margin: 0; } +fieldset { margin: 0; padding: 0; border: none; } +legend { width: 600px; box-sizing: border-box; padding: 0; background: #ddd; border: 1px solid; } +[style="display: table"] span, +[style="display: inline-table"] span { display: table-cell; } +[style="display: table-row-group"], +[style="display: table-header-group"], +[style="display: table-footer-group"], +[style="display: table-row"], +[style="display: table-column-group"], +[style="display: table-column"] { padding-left: 5em; /* would be ignored if not blockified */ } +[style="display: table-cell"] { margin-left: 5em; /* would be ignored if not blockified */ } +.rb { display: ruby-base; } +.rt { display: ruby-text; } +[style="display: grid"], +[style="display: inline-grid"] { grid-template-columns: auto auto; } +[style="display: flex"] span, +[style="display: inline-flex"] span { display: block; flex-grow: 1 } +</style> +<fieldset> + <legend style="display: table"><span>table</span><span>table</span></legend> +</fieldset> + +<fieldset> + <legend style="display: table-row-group">table-row-group</legend> +</fieldset> + +<fieldset> + <legend style="display: table-header-group">table-header-group</legend> +</fieldset> + +<fieldset> + <legend style="display: table-footer-group">table-footer-group</legend> +</fieldset> + +<fieldset> + <legend style="display: table-row">table-row</legend> +</fieldset> + +<fieldset> + <legend style="display: table-cell">table-cell</legend> +</fieldset> + +<fieldset> + <legend style="display: table-column-group">table-column-group</legend> +</fieldset> + +<fieldset> + <legend style="display: table-column">table-column</legend> +</fieldset> + +<fieldset> + <legend style="display: table-caption">table-caption</legend> +</fieldset> + +<fieldset> + <legend style="display: flow">flow</legend> +</fieldset> + +<fieldset> + <legend style="display: flow-root">flow-root</legend> +</fieldset> + +<fieldset> + <legend style="display: run-in">run-in</legend> +</fieldset> + +<fieldset> + <legend style="display: inline">inline</legend> +</fieldset> + +<fieldset> + <legend style="display: inline-block">inline-block</legend> +</fieldset> + +<fieldset> + <legend style="display: inline-table"><span>inline-table</span><span>inline-table</span></legend> +</fieldset> + +<fieldset> + <legend style="display: ruby"><span class=rb>ruby</span><span class=rt>ruby</span></legend> +</fieldset> + +<fieldset> + <legend style="display: ruby-base">ruby-base</legend> +</fieldset> + +<fieldset> + <legend style="display: ruby-text">ruby-text</legend> +</fieldset> + +<fieldset> + <legend style="display: ruby-base-container">ruby-base-container</legend> +</fieldset> + +<fieldset> + <legend style="display: ruby-text-container">ruby-text-container</legend> +</fieldset> + +<fieldset> + <legend style="display: grid"><span>grid</span><span>grid</span></legend> +</fieldset> + +<fieldset> + <legend style="display: inline-grid"><span>inline-grid</span><span>inline-grid</span></legend> +</fieldset> + +<fieldset> + <legend style="display: flex"><span>flex</span><span>flex</span></legend> +</fieldset> + +<fieldset> + <legend style="display: inline-flex"><span>inline-flex</span><span>inline-flex</span></legend> +</fieldset> +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt new file mode 100644 index 0000000..403e37a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt
@@ -0,0 +1,8 @@ +This is a testharness.js-based test. +PASS flex +FAIL inline-flex assert_equals: display expected "inline-flex" but got "flex" +PASS grid +FAIL inline-grid assert_equals: display expected "inline-grid" but got "grid" +PASS multicol +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item.html index c26b50c..e9676435 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item.html +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item.html
@@ -1,6 +1,6 @@ <!doctype html> <title>legend and dipslay: list-item</title> -<link rel=match href=fieldset-list-item-ref.html> +<link rel=match href=legend-list-item-ref.html> <style> fieldset { margin: 0; padding: 0; border: none; } legend { margin: 0 40px; padding: 0; display: list-item; }
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-margin-inline.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-margin-inline.html new file mode 100644 index 0000000..8daf78d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-margin-inline.html
@@ -0,0 +1,50 @@ +<!doctype html> +<title>legend and margin (inline direction)</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<style> + fieldset { margin: 0 0 10px 0; padding: 20px; border: 10px solid; width: 500px; } + legend { height: 10px; width: 200px; padding: 0; } + + #legend-center { margin-left: auto; margin-right: auto; } + #legend-right { margin-left: auto; } + #legend-10 { margin-left: 10px; } +</style> +<fieldset> + <legend id=legend-left>left</legend> +</fieldset> +<fieldset> + <legend id=legend-center>center</legend> +</fieldset> +<fieldset> + <legend id=legend-right>right</legend> +</fieldset> +<fieldset> + <legend id=legend-10>10px</legend> +</fieldset> + +<script> + const legends = document.getElementsByTagName('legend'); + const [legendLeft, legendCenter, legendRight, legend10] = legends; + + const expectedLeft = 8 + 10 + 20; + const expectedCenter = expectedLeft + (500 / 2) - (200 / 2); + const expectedRight = expectedLeft + 500 - 200; + const expected10 = expectedLeft + 10; + + test(() => { + assert_equals(legendLeft.offsetLeft, expectedLeft); + }, 'left'); + + test(() => { + assert_equals(legendCenter.offsetLeft, expectedCenter); + }, 'center'); + + test(() => { + assert_equals(legendRight.offsetLeft, expectedRight); + }, 'right'); + + test(() => { + assert_equals(legend10.offsetLeft, expected10); + }, '10px'); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/scroll-animations/idlharness.window-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/scroll-animations/idlharness.window-expected.txt index 1c82ba7..9911f4d9 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/scroll-animations/idlharness.window-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/scroll-animations/idlharness.window-expected.txt
@@ -8,8 +8,8 @@ PASS ScrollTimeline interface: existence and properties of interface prototype object's @@unscopables property PASS ScrollTimeline interface: attribute scrollSource PASS ScrollTimeline interface: attribute orientation -FAIL ScrollTimeline interface: attribute startScrollOffset assert_true: The prototype object must have a property "startScrollOffset" expected true got false -FAIL ScrollTimeline interface: attribute endScrollOffset assert_true: The prototype object must have a property "endScrollOffset" expected true got false +PASS ScrollTimeline interface: attribute startScrollOffset +PASS ScrollTimeline interface: attribute endScrollOffset PASS ScrollTimeline interface: attribute timeRange FAIL ScrollTimeline interface: attribute fill assert_true: The prototype object must have a property "fill" expected true got false FAIL ScrollTimeline must be primary interface of new ScrollTimeline() assert_equals: Unexpected exception when evaluating object expected null but got object "NotSupportedError: Failed to construct 'ScrollTimeline': 'auto' value for timeRange not yet supported"
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https-expected.txt index 10b1fd1..28a5b78 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https-expected.txt
@@ -11,6 +11,7 @@ PASS SW-fallbacked redirect to same-origin other-scope. PASS SW-fallbacked redirect to other-origin out-scope. PASS SW-fallbacked redirect to other-origin in-scope. +PASS SW-fallbacked redirect to other-origin and back to same-origin. PASS SW-generated redirect to same-origin out-scope. FAIL SW-generated redirect to same-origin out-scope with a hash fragment. assert_object_equals: Intercepted URLs should match. property "0" expected ["https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F#ref"] got ["https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F"] FAIL SW-generated redirect to same-origin out-scope with different hash fragments. assert_object_equals: Intercepted URLs should match. property "0" expected ["https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F%23ref2#ref"] got ["https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F%23ref2"]
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https.html index 0490f2b..edd3712 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https.html
@@ -1,6 +1,11 @@ <!DOCTYPE html> <title>Service Worker: Navigation redirection</title> <meta name="timeout" content="long"> +<!-- empty variant tests document.location and intercepted URLs --> +<meta name="variant" content=""> +<!-- client variant tests the Clients API (resultingClientId and Client.url) --> +<meta name="variant" content="?client"> + <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/get-host-info.sub.js"></script> @@ -76,40 +81,217 @@ assert_object_equals(urls, expected_urls, 'Intercepted URLs should match.'); } +// Checks |clients| returned from a worker. Only the client matching +// |expected_final_client_tag| should be found. Returns true if a client was +// found. Note that the final client is not necessarily found by this worker, +// if the client is cross-origin. +// +// |clients| is an object like: +// {x: {found: true, id: id1, url: url1}, b: {found: false}} +function check_clients(clients, + expected_id, + expected_url, + expected_final_client_tag, + worker_name) { + let found = false; + Object.keys(clients).forEach(key => { + const info = clients[key]; + if (info.found) { + assert_true(expected_final_client_tag, + `${worker_name} client tag exists`); + assert_equals(key, expected_final_client_tag, + `${worker_name} client tag matches`); + assert_equals(info.id, expected_id, `${worker_name} client id`); + assert_equals(info.url, expected_url, `${worker_name} client url`); + found = true; + } + }); + return found; +} + +function check_resulting_client_ids(infos, expected_infos, actual_ids, worker) { + assert_equals(infos.length, expected_infos.length, + `request length for ${worker}`); + for (var i = 0; i < infos.length; i++) { + const tag = expected_infos[i].resultingClientIdTag; + const url = expected_infos[i].url; + const actual_id = infos[i].resultingClientId; + const expected_id = actual_ids[tag]; + assert_equals(typeof(actual_id), 'string', + `resultingClientId for ${url} request to ${worker}`); + if (expected_id) { + assert_equals(requestInfos[0], expected_id, + `resultingClientId for ${url} request to ${worker}`); + } else { + actual_ids[key] = actual_id; + } + } +} + // Creates an iframe and navigates to |url|, which is expected to start a chain // of redirects. // - |expected_last_url| is the expected window.location after the // navigation. +// // - |expected_request_infos| is the expected requests that the service workers // were dispatched fetch events for. The format is: // [ -// [{url: url1}, {url: url2}], // requests from workers[0], -// [{url: url1}, // requests from workers[1], -// [{url: url1}, {url: url2}] // requests from cross-origin worker +// [ +// // Requests received by workers[0]. +// {url: url1, resultingClientIdTag: 'a'}, +// {url: url2, resultingClientIdTag: 'a'} +// ], +// [ +// // Requests received by workers[1]. +// {url: url3, resultingClientIdTag: 'a'} +// ], +// [ +// // Requests received by the cross-origin worker. +// {url: url4, resultingClientIdTag: 'x'} +// {url: url5, resultingClientIdTag: 'x'} +// ] // ] +// Here, |url| is |event.request.url| and |resultingClientIdTag| represents +// |event.resultingClientId|. Since the actual client ids are not known +// beforehand, the expectation isn't the literal expected value, but all equal +// tags must map to the same actual id. +// +// - |expected_final_client_tag| is the resultingClientIdTag that is +// expected to map to the created client's id. This is null if there +// is no such tag, which can happen when the final request was a cross-origin +// redirect to out-scope, so no worker received a fetch event whose +// resultingClientId is the id of the resulting client. +// +// In the example above: +// - workers[0] receives two requests with the same resultingClientId. +// - workers[1] receives one request also with that resultingClientId. +// - The cross-origin worker receives two requests with the same +// resultingClientId which differs from the previous one. +// - Assuming |expected_final_client_tag| is 'x', then the created +// client has the id seen by the cross-origin worker above. function redirect_test(url, expected_last_url, expected_request_infos, + expected_final_client_tag, test_name) { promise_test(async t => { - const message_promise = new Promise(resolve => { - // A message with ID 'last_url' will be sent from the iframe. - message_resolvers['last_url'] = resolve; - }); const frame = await with_iframe(url); t.add_cleanup(() => { frame.remove(); }); - const expected_intercepted_urls = expected_request_infos.map(requests => { - return requests.map(info => { - return info.url; - }); - }); - await check_all_intercepted_urls(expected_intercepted_urls); - const last_url = await message_promise; - assert_equals(last_url, expected_last_url, 'Last URL should match.'); + // Switch on variant. + if (document.location.search == '?client') { + return client_variant_test(url, expected_last_url, expected_request_infos, + expected_final_client_tag, test_name); + } + + return default_variant_test(url, expected_last_url, expected_request_infos, + expected_final_client_tag, test_name); }, test_name); } +// The default variant tests the request interception chain and +// resulting document.location. +async function default_variant_test(url, + expected_last_url, + expected_request_infos, + expected_final_client_tag, + test_name) { + const message_promise = new Promise(resolve => { + // A message with ID 'last_url' will be sent from the iframe. + message_resolvers['last_url'] = resolve; + }); + + const expected_intercepted_urls = expected_request_infos.map( + requests_for_worker => { + return requests_for_worker.map(info => { + return info.url; + }); + }); + await check_all_intercepted_urls(expected_intercepted_urls); + const last_url = await message_promise; + assert_equals(last_url, expected_last_url, 'Last URL should match.'); +} + +// The "client" variant tests the Clients API using resultingClientId. +async function client_variant_test(url, + expected_last_url, + expected_request_infos, + expected_final_client_tag, + test_name) { + // A message with ID 'last_url' will be sent from the iframe, but this + // variant doesn't use it. Just define a resolver so it doesn't crash. + message_resolvers['last_url'] = () => {}; + + // Request infos is an array like: + // [ + // [{url: url1, resultingClientIdTag: tag1}], + // [{url: url2, resultingClientIdTag: tag2}], + // [{url: url3: resultingClientIdTag: tag3}] + // ] + const requestInfos = await get_all_request_infos(); + + // We check the actual infos against the expected ones, and learn the + // actual ids as we go. + const actual_ids = {}; + check_resulting_client_ids(requestInfos[0], + expected_request_infos[0], + actual_ids, + 'worker0'); + check_resulting_client_ids(requestInfos[1], + expected_request_infos[1], + actual_ids, + 'worker1'); + check_resulting_client_ids(requestInfos[2], + expected_request_infos[2], + actual_ids, + 'crossOriginWorker'); + + // Now |actual_ids| maps tag to actual id: + // {x: id1, b: id2, c: id3} + // Ask each worker to try to resolve the actual ids to clients. + // Only |expected_final_client_tag| should resolve to a client. + const client_infos = await get_all_clients(actual_ids); + + // Client infos is an object like: + // { + // worker0: {x: {found: true, id: id1, url: url1}, b: {found: false}}, + // worker1: {x: {found: true, id: id1, url: url1}}, + // crossOriginWorker: {x: {found: false}}, {b: {found: false}} + // } + // + // Now check each client info. check_clients() verifies each info: only + // |expected_final_client_tag| should ever be found and the found client + // should have the expected url and id. A wrinkle is that not all workers + // will find the client, if they are cross-origin to the client. This + // means check_clients() trivially passes if no clients are found. So + // additionally check that at least one worker found the client (|found|), + // if that was expected (|expect_found|). + let found = false; + const expect_found = !!expected_final_client_tag; + const expected_id = actual_ids[expected_final_client_tag]; + found = check_clients(client_infos.worker0, + expected_id, + expected_last_url, + expected_final_client_tag, + 'worker0'); + found = check_clients(client_infos.worker1, + expected_id, + expected_last_url, + expected_final_client_tag, + 'worker1') || found; + found = check_clients(client_infos.crossOriginWorker, + expected_id, + expected_last_url, + expected_final_client_tag, + 'crossOriginWorker') || found; + assert_equals(found, expect_found, 'client found'); + + if (!expect_found) { + // TODO(falken): Ask the other origin frame if it has a client of the + // expected URL. + } +} + window.addEventListener('message', on_message, false); function on_message(e) { @@ -133,6 +315,27 @@ }); } +async function get_all_clients(actual_ids) { + const client_infos = {}; + client_infos['worker0'] = await get_clients(workers[0], actual_ids); + client_infos['worker1'] = await get_clients(workers[1], actual_ids); + client_infos['crossOriginWorker'] = + await send_to_iframe(other_origin_frame, + {command: 'get_clients', actual_ids}); + return client_infos; +} + +function get_clients(worker, actual_ids) { + return new Promise(resolve => { + var channel = new MessageChannel(); + channel.port1.onmessage = (msg) => { + resolve(msg.data.clients); + }; + worker.postMessage({command: 'getClients', actual_ids, port: channel.port2}, + [channel.port2]); + }); +} + // Returns an array of the URLs that |worker| received fetch events for: // [url1, url2] async function get_intercepted_urls(worker) { @@ -142,7 +345,10 @@ // Returns the requests that |worker| received fetch events for. The return // value is an array of format: -// [{url: url1}, {url: url2}] +// [ +// {url: url1, resultingClientId: id}, +// {url: url2, resultingClientId: id} +// ] function get_request_infos(worker) { return new Promise(resolve => { var channel = new MessageChannel(); @@ -154,6 +360,29 @@ }); } +// Returns an array of the requests the workers received fetch events for: +// [ +// // Requests from workers[0]. +// [ +// {url: url1, resultingClientIdTag: tag1}, +// {url: url2, resultingClientIdTag: tag1} +// ], +// +// // Requests from workers[1]. +// [{url: url3, resultingClientIdTag: tag2}], +// +// // Requests from the cross-origin worker. +// [] +// ] +async function get_all_request_infos() { + const request_infos = []; + request_infos.push(await get_request_infos(workers[0])); + request_infos.push(await get_request_infos(workers[1])); + request_infos.push(await send_to_iframe(other_origin_frame, + {command: 'get_request_infos'})); + return request_infos; +} + let url; let url1; let url2; @@ -163,7 +392,8 @@ redirect_test( OUT_SCOPE + 'url=' + encodeURIComponent(url), url, - [[{url}], [], []], + [[{url, resultingClientIdTag: 'x'}], [], []], + 'x', 'Normal redirect to same-origin scope.'); @@ -171,30 +401,33 @@ redirect_test( OUT_SCOPE + 'url=' + encodeURIComponent(SCOPE1) + '#ref', url, - [[{url}], [], []], + [[{url, resultingClientIdTag: 'x'}], [], []], + 'x', 'Normal redirect to same-origin scope with a hash fragment.'); url = SCOPE1 + '#ref2'; redirect_test( OUT_SCOPE + 'url=' + encodeURIComponent(url) + '#ref', url, - [[{url}], [], []], + [[{url, resultingClientIdTag: 'x'}], [], []], + 'x', 'Normal redirect to same-origin scope with different hash fragments.'); url = OTHER_ORIGIN_SCOPE; redirect_test( OUT_SCOPE + 'url=' + encodeURIComponent(url), url, - [[], [], [{url}]], + [[], [], [{url, resultingClientIdTag: 'x'}]], + 'x', 'Normal redirect to other-origin scope.'); - // SW fallbacked redirect. SW doesn't handle the fetch request. url = SCOPE1 + 'url=' + encodeURIComponent(OUT_SCOPE); redirect_test( url, OUT_SCOPE, - [[{url}], [], []], + [[{url, resultingClientIdTag: 'x'}], [], []], + 'x', 'SW-fallbacked redirect to same-origin out-scope.'); url1 = SCOPE1 + 'url=' + encodeURIComponent(SCOPE1); @@ -202,7 +435,15 @@ redirect_test( url1, url2, - [[{url: url1}, {url: url2}], [], []], + [ + [ + {url: url1, resultingClientIdTag: 'x'}, + {url: url2, resultingClientIdTag: 'x'} + ], + [], + [] + ], + 'x', 'SW-fallbacked redirect to same-origin same-scope.'); url1 = SCOPE1 + 'url=' + encodeURIComponent(SCOPE1) + '#ref'; @@ -210,7 +451,15 @@ redirect_test( url1, url2, - [[{url: url1}, {url: url2}], [], []], + [ + [ + {url: url1, resultingClientIdTag: 'x'}, + {url: url2, resultingClientIdTag: 'x'} + ], + [], + [] + ], + 'x', 'SW-fallbacked redirect to same-origin same-scope with a hash fragment.'); url1 = SCOPE1 + 'url=' + encodeURIComponent(SCOPE1 + '#ref2') + '#ref'; @@ -218,7 +467,15 @@ redirect_test( url1, url2, - [[{url: url1}, {url: url2}], [], []], + [ + [ + {url: url1, resultingClientIdTag: 'x'}, + {url: url2, resultingClientIdTag: 'x'} + ], + [], + [] + ], + 'x', 'SW-fallbacked redirect to same-origin same-scope with different hash ' + 'fragments.'); @@ -227,7 +484,12 @@ redirect_test( url1, url2, - [[{url: url1}], [{url: url2}], []], + [ + [{url: url1, resultingClientIdTag: 'x'}], + [{url: url2, resultingClientIdTag: 'x'}], + [] + ], + 'x', 'SW-fallbacked redirect to same-origin other-scope.'); url1 = SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE); @@ -235,7 +497,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'a'}], [], []], + 'x', 'SW-fallbacked redirect to other-origin out-scope.'); url1 = SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE); @@ -243,10 +506,32 @@ redirect_test( url1, url2, - [[{url: url1}], [], [{url: url2}]], + [ + [{url: url1, resultingClientIdTag: 'a'}], + [], + [{url: url2, resultingClientIdTag: 'x'}] + ], + 'x', 'SW-fallbacked redirect to other-origin in-scope.'); +url3 = SCOPE1; +url2 = OTHER_ORIGIN_SCOPE + 'url=' + encodeURIComponent(url3); +url1 = SCOPE1 + 'url=' + encodeURIComponent(url2); +redirect_test( + url1, + url3, + [ + [ + {url: url1, resultingClientIdTag: 'a'}, + {url: url3, resultingClientIdTag: 'x'} + ], + [], + [{url: url2, resultingClientIdTag: 'b'}] + ], + 'x', + 'SW-fallbacked redirect to other-origin and back to same-origin.'); + // SW generated redirect. // SW: event.respondWith(Response.redirect(params['url'])); url1 = SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE); @@ -254,7 +539,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'a'}], [], []], + null, 'SW-generated redirect to same-origin out-scope.'); url1 = SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE) + '#ref'; @@ -262,7 +548,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'x'}], [], []], + 'x', 'SW-generated redirect to same-origin out-scope with a hash fragment.'); url1 = SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE + '#ref2') + '#ref'; @@ -270,7 +557,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'x'}], [], []], + 'x', 'SW-generated redirect to same-origin out-scope with different hash ' + 'fragments.'); @@ -279,7 +567,15 @@ redirect_test( url1, url2, - [[{url: url1}, {url: url2}], [], []], + [ + [ + {url: url1, resultingClientIdTag: 'x'}, + {url: url2, resultingClientIdTag: 'x'} + ], + [], + [] + ], + 'x', 'SW-generated redirect to same-origin same-scope.'); url1 = SCOPE1 + 'sw=gen&url=' + encodeURIComponent(SCOPE2); @@ -287,7 +583,12 @@ redirect_test( url1, url2, - [[{url: url1}], [{url: url2}], []], + [ + [{url: url1, resultingClientIdTag: 'x'}], + [{url: url2, resultingClientIdTag: 'x'}], + [] + ], + 'x', 'SW-generated redirect to same-origin other-scope.'); url1 = SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE); @@ -295,7 +596,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'a'}], [], []], + null, 'SW-generated redirect to other-origin out-scope.'); url1 = SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE); @@ -304,10 +606,11 @@ url1, url2, [ - [{url: url1}], + [{url: url1, resultingClientIdTag: 'a'}], [], - [{url: url2}] + [{url: url2, resultingClientIdTag: 'x'}] ], + 'x', 'SW-generated redirect to other-origin in-scope.'); @@ -318,7 +621,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'x'}], [], []], + 'x', 'SW-fetched redirect to same-origin out-scope.'); url1 = SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE1); @@ -326,7 +630,15 @@ redirect_test( url1, url2, - [[{url: url1}, {url: url2}], [], []], + [ + [ + {url: url1, resultingClientIdTag: 'x'}, + {url: url2, resultingClientIdTag: 'x'} + ], + [], + [] + ], + 'x', 'SW-fetched redirect to same-origin same-scope.'); url1 = SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE2); @@ -335,10 +647,11 @@ url1, url2, [ - [{url: url1}], - [{url: url2}], + [{url: url1, resultingClientIdTag: 'x'}], + [{url: url2, resultingClientIdTag: 'x'}], [] ], + 'x', 'SW-fetched redirect to same-origin other-scope.'); url1 = SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE); @@ -346,7 +659,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'a'}], [], []], + null, 'SW-fetched redirect to other-origin out-scope.'); url1 = SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE); @@ -355,10 +669,11 @@ url1, url2, [ - [{url: url1}], + [{url: url1, resultingClientIdTag: 'a'}], [], - [{url: url2}] + [{url: url2, resultingClientIdTag: 'x'}] ], + 'x', 'SW-fetched redirect to other-origin in-scope.'); @@ -370,7 +685,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'x'}], [], []], + 'x', 'Redirect to same-origin out-scope with opaque redirect response.'); url1 = SCOPE1 + 'sw=manual&url=' + encodeURIComponent(SCOPE1); @@ -378,7 +694,15 @@ redirect_test( url1, url2, - [[{url: url1}, {url: url2}], [], []], + [ + [ + {url: url1, resultingClientIdTag: 'x'}, + {url: url2, resultingClientIdTag: 'x'} + ], + [], + [] + ], + 'x', 'Redirect to same-origin same-scope with opaque redirect response.'); url1 = SCOPE1 + 'sw=manual&url=' + encodeURIComponent(SCOPE2); @@ -386,7 +710,12 @@ redirect_test( url1, url2, - [[{url: url1}], [{url: url2}], []], + [ + [{url: url1, resultingClientIdTag: 'x'}], + [{url: url2, resultingClientIdTag: 'x'}], + [] + ], + 'x', 'Redirect to same-origin other-scope with opaque redirect response.'); url1 = SCOPE1 + 'sw=manual&url=' + encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE); @@ -394,7 +723,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'a'}], [], []], + null, 'Redirect to other-origin out-scope with opaque redirect response.'); url1 = SCOPE1 + 'sw=manual&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE); @@ -402,12 +732,18 @@ redirect_test( url1, url2, - [[{url: url1}], [], [{url: url2}]], + [ + [{url: url1, resultingClientIdTag: 'a'}], + [], + [{url: url2, resultingClientIdTag: 'x'}] + ], + 'x', 'Redirect to other-origin in-scope with opaque redirect response.'); url= SCOPE1 + 'sw=manual&noLocationRedirect'; redirect_test( - url, url, [[{url}], [], []], + url, url, [[{url, resultingClientIdTag: 'x'}], [], []], + 'x', 'No location redirect response.'); @@ -418,7 +754,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'x'}], [], []], + 'x', 'Redirect to same-origin out-scope with opaque redirect response which ' + 'is passed through Cache.'); @@ -428,10 +765,14 @@ url1, url2, [ - [{url: url1}, {url: url2}], + [ + {url: url1, resultingClientIdTag: 'x'}, + {url: url2, resultingClientIdTag: 'x'} + ], [], [] ], + 'x', 'Redirect to same-origin same-scope with opaque redirect response which ' + 'is passed through Cache.'); @@ -441,10 +782,11 @@ url1, url2, [ - [{url: url1}], - [{url: url2}], + [{url: url1, resultingClientIdTag: 'x'}], + [{url: url2, resultingClientIdTag: 'x'}], [] ], + 'x', 'Redirect to same-origin other-scope with opaque redirect response which ' + 'is passed through Cache.'); @@ -454,7 +796,8 @@ redirect_test( url1, url2, - [[{url: url1}], [], []], + [[{url: url1, resultingClientIdTag: 'a'}], [], []], + null, 'Redirect to other-origin out-scope with opaque redirect response which ' + 'is passed through Cache.'); @@ -465,10 +808,11 @@ url1, url2, [ - [{url: url1}], + [{url: url1, resultingClientIdTag: 'a'}], [], - [{url: url2}], + [{url: url2, resultingClientIdTag: 'x'}], ], + 'x', 'Redirect to other-origin in-scope with opaque redirect response which ' + 'is passed through Cache.'); @@ -476,7 +820,8 @@ redirect_test( url, url, - [[{url}], [], []], + [[{url, resultingClientIdTag: 'x'}], [], []], + 'x', 'No location redirect response via Cache.'); // Clean up the test environment. This promise_test() needs to be the last one.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https_client-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https_client-expected.txt new file mode 100644 index 0000000..8856e57f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect.https_client-expected.txt
@@ -0,0 +1,41 @@ +This is a testharness.js-based test. +PASS initialize global state +FAIL Normal redirect to same-origin scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py? request to worker0 expected "string" but got "undefined" +FAIL Normal redirect to same-origin scope with a hash fragment. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?#ref request to worker0 expected "string" but got "undefined" +FAIL Normal redirect to same-origin scope with different hash fragments. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?#ref2 request to worker0 expected "string" but got "undefined" +FAIL Normal redirect to other-origin scope. assert_equals: resultingClientId for https://www1.web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py? request to crossOriginWorker expected "string" but got "undefined" +FAIL SW-fallbacked redirect to same-origin out-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fallbacked redirect to same-origin same-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fallbacked redirect to same-origin same-scope with a hash fragment. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F#ref request to worker0 expected "string" but got "undefined" +FAIL SW-fallbacked redirect to same-origin same-scope with different hash fragments. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F%23ref2#ref request to worker0 expected "string" but got "undefined" +FAIL SW-fallbacked redirect to same-origin other-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope2.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fallbacked redirect to other-origin out-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fallbacked redirect to other-origin in-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fallbacked redirect to other-origin and back to same-origin. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3Furl%3Dhttps%253A%252F%252Fweb-platform.test%253A8444%252Fservice-workers%252Fservice-worker%252Fresources%252Fnavigation-redirect-scope1.py%253F request to worker0 expected "string" but got "undefined" +FAIL SW-generated redirect to same-origin out-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-generated redirect to same-origin out-scope with a hash fragment. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F#ref request to worker0 expected "string" but got "undefined" +FAIL SW-generated redirect to same-origin out-scope with different hash fragments. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F%23ref2#ref request to worker0 expected "string" but got "undefined" +FAIL SW-generated redirect to same-origin same-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-generated redirect to same-origin other-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope2.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-generated redirect to other-origin out-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-generated redirect to other-origin in-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=gen&url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fetched redirect to same-origin out-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=fetch&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fetched redirect to same-origin same-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=fetch&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fetched redirect to same-origin other-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=fetch&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope2.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fetched redirect to other-origin out-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=fetch&url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL SW-fetched redirect to other-origin in-scope. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=fetch&url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL Redirect to same-origin out-scope with opaque redirect response. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manual&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL Redirect to same-origin same-scope with opaque redirect response. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manual&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL Redirect to same-origin other-scope with opaque redirect response. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manual&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope2.py%3F request to worker0 expected "string" but got "undefined" +FAIL Redirect to other-origin out-scope with opaque redirect response. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manual&url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL Redirect to other-origin in-scope with opaque redirect response. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manual&url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL No location redirect response. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manual&noLocationRedirect request to worker0 expected "string" but got "undefined" +FAIL Redirect to same-origin out-scope with opaque redirect response which is passed through Cache. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manualThroughCache&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL Redirect to same-origin same-scope with opaque redirect response which is passed through Cache. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manualThroughCache&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL Redirect to same-origin other-scope with opaque redirect response which is passed through Cache. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manualThroughCache&url=https%3A%2F%2Fweb-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope2.py%3F request to worker0 expected "string" but got "undefined" +FAIL Redirect to other-origin out-scope with opaque redirect response which is passed through Cache. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manualThroughCache&url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-out-scope.py%3F request to worker0 expected "string" but got "undefined" +FAIL Redirect to other-origin in-scope with opaque redirect response which is passed through Cache. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manualThroughCache&url=https%3A%2F%2Fwww1.web-platform.test%3A8444%2Fservice-workers%2Fservice-worker%2Fresources%2Fnavigation-redirect-scope1.py%3F request to worker0 expected "string" but got "undefined" +FAIL No location redirect response via Cache. assert_equals: resultingClientId for https://web-platform.test:8444/service-workers/service-worker/resources/navigation-redirect-scope1.py?sw=manualThroughCache&noLocationRedirect request to worker0 expected "string" but got "undefined" +PASS clean up global state +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/navigation-redirect-other-origin.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/navigation-redirect-other-origin.html index 0d2825f..d82571d1a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/navigation-redirect-other-origin.html +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/navigation-redirect-other-origin.html
@@ -44,6 +44,20 @@ }); } +function get_clients(worker, actual_ids) { + return new Promise(function(resolve) { + var channel = new MessageChannel(); + channel.port1.onmessage = (msg) => { + resolve(msg.data.clients); + }; + worker.postMessage({ + command: 'getClients', + actual_ids, + port: channel.port2 + }, [channel.port2]); + }); +} + window.addEventListener('message', on_message, false); function on_message(e) { @@ -59,6 +73,11 @@ .then(function(data) { send_result(e.data.id, data); }); + } else if (command == 'get_clients') { + get_clients(worker, e.data.message.actual_ids) + .then(function(data) { + send_result(e.data.id, data); + }); } else if (command == 'unregister') { registration.unregister() .then(function() {
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/redirect-worker.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/redirect-worker.js index bf0a3a8..f3ac411 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/redirect-worker.js +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/redirect-worker.js
@@ -5,6 +5,13 @@ var waitUntilPromiseList = []; +// Sends the requests seen by this worker. The output is: +// { +// requestInfos: [ +// {url: url1, resultingClientId: id1}, +// {url: url2, resultingClientId: id2}, +// ] +// } async function getRequestInfos(event) { // Wait for fetch events to finish. await Promise.all(waitUntilPromiseList); @@ -15,8 +22,11 @@ const requestList = await cache.keys(); const requestInfos = []; for (let i = 0; i < requestList.length; i++) { + const response = await cache.match(requestList[i]); + const body = await response.json(); requestInfos[i] = { url: requestList[i].url, + resultingClientId: body.resultingClientId }; } await caches.delete(cacheName); @@ -24,13 +34,51 @@ event.data.port.postMessage({requestInfos}); } +// Sends the results of clients.get(id) from this worker. The +// input is: +// { +// actual_ids: {a: id1, b: id2, x: id3} +// } +// +// The output is: +// { +// clients: { +// a: {found: false}, +// b: {found: false}, +// x: { +// id: id3, +// url: url1, +// found: true +// } +// } +// } +async function getClients(event) { + // |actual_ids| is like: + // {a: id1, b: id2, x: id3} + const actual_ids = event.data.actual_ids; + const result = {} + for (let key of Object.keys(actual_ids)) { + const id = actual_ids[key]; + const client = await self.clients.get(id); + if (client === undefined) { + result[key] = {found: false}; + return; + } + result[key] = {found: true, url: client.url, id: client.id}; + } + event.data.port.postMessage({clients: result}); +} + self.addEventListener('message', async function(event) { if (event.data.command == 'getRequestInfos') { event.waitUntil(getRequestInfos(event)); return; } - // TODO(falken): Add a getClientInfos command to test Clients API. + if (event.data.command == 'getClients') { + event.waitUntil(getClients(event)); + return; + } }); function get_query_params(url) { @@ -49,7 +97,11 @@ self.addEventListener('fetch', function(event) { var waitUntilPromise = caches.open(cacheName).then(function(cache) { - return cache.put(event.request, new Response()); + const responseBody = {}; + responseBody['resultingClientId'] = event.resultingClientId; + const headers = new Headers({'Content-Type': 'application/json'}); + const response = new Response(JSON.stringify(responseBody), {headers}); + return cache.put(event.request, response); }); event.waitUntil(waitUntilPromise);
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceServers-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceServers-expected.txt index 9c67e8d..e21f127 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceServers-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceServers-expected.txt
@@ -1,6 +1,8 @@ This is a testharness.js-based test. -Found 73 tests; 26 PASS, 47 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 75 tests; 32 PASS, 43 FAIL, 0 TIMEOUT, 0 NOTRUN. FAIL new RTCPeerConnection() should have default configuration.iceServers of undefined assert_equals: expected (undefined) undefined but got (object) [] +PASS new RTCPeerConnection(config) - {} should succeed +PASS setConfiguration(config) - {} should succeed PASS new RTCPeerConnection(config) - { iceServers: null } should throw TypeError PASS setConfiguration(config) - { iceServers: null } should throw TypeError FAIL new RTCPeerConnection(config) - { iceServers: undefined } should succeed assert_equals: expected (undefined) undefined but got (object) [] @@ -41,6 +43,10 @@ PASS setConfiguration(config) - with turns server and only username should throw InvalidAccessError PASS new RTCPeerConnection(config) - with turns server and only credential should throw InvalidAccessError PASS setConfiguration(config) - with turns server and only credential should throw InvalidAccessError +PASS new RTCPeerConnection(config) - with "" url should throw SyntaxError +PASS setConfiguration(config) - with "" url should throw SyntaxError +PASS new RTCPeerConnection(config) - with ["stun:stun1.example.net", ""] url should throw SyntaxError +PASS setConfiguration(config) - with ["stun:stun1.example.net", ""] url should throw SyntaxError PASS new RTCPeerConnection(config) - with relative url should throw SyntaxError PASS setConfiguration(config) - with relative url should throw SyntaxError PASS new RTCPeerConnection(config) - with http url should throw SyntaxError @@ -48,19 +54,19 @@ FAIL new RTCPeerConnection(config) - with invalid turn url should throw SyntaxError assert_throws: function "() => makePc({ iceServers: [{ urls: 'turn://example.org/foo?x=y' - }] })" threw object "InvalidAccessError: Failed to construct 'RTCPeerConnection': Both username and credential are required when the URL scheme is "turn" or "turns"." that is not a DOMException SyntaxError: property "code" is equal to 15, expected 12 + }] })" threw object "InvalidAccessError: Failed to construct 'RTCPeerConnection': Both username and credential are required when the URL scheme is "turn" or "turns"." ("InvalidAccessError") expected object "SyntaxError" ("SyntaxError") FAIL setConfiguration(config) - with invalid turn url should throw SyntaxError assert_throws: function "() => makePc({ iceServers: [{ urls: 'turn://example.org/foo?x=y' - }] })" threw object "InvalidAccessError: Failed to execute 'setConfiguration' on 'RTCPeerConnection': Both username and credential are required when the URL scheme is "turn" or "turns"." that is not a DOMException SyntaxError: property "code" is equal to 15, expected 12 + }] })" threw object "InvalidAccessError: Failed to execute 'setConfiguration' on 'RTCPeerConnection': Both username and credential are required when the URL scheme is "turn" or "turns"." ("InvalidAccessError") expected object "SyntaxError" ("SyntaxError") FAIL new RTCPeerConnection(config) - with invalid stun url should throw SyntaxError assert_throws: function "() => makePc({ iceServers: [{ urls: 'stun://example.org/foo?x=y' - }] })" threw object "NotSupportedError: Failed to construct 'RTCPeerConnection': Failed to initialize native PeerConnection." that is not a DOMException SyntaxError: property "code" is equal to 9, expected 12 + }] })" threw object "NotSupportedError: Failed to construct 'RTCPeerConnection': Failed to initialize native PeerConnection." ("NotSupportedError") expected object "SyntaxError" ("SyntaxError") FAIL setConfiguration(config) - with invalid stun url should throw SyntaxError assert_throws: function "() => makePc({ iceServers: [{ urls: 'stun://example.org/foo?x=y' - }] })" threw object "OperationError: Failed to execute 'setConfiguration' on 'RTCPeerConnection': Could not update the PeerConnection with the given configuration." that is not a DOMException SyntaxError: property "code" is equal to 0, expected 12 + }] })" threw object "OperationError: Failed to execute 'setConfiguration' on 'RTCPeerConnection': Could not update the PeerConnection with the given configuration." ("OperationError") expected object "SyntaxError" ("SyntaxError") FAIL new RTCPeerConnection(config) - with empty urls should throw SyntaxError assert_throws: function "() => makePc({ iceServers: [{ urls: [] @@ -139,9 +145,5 @@ FAIL setConfiguration(config) - with stun server, credentialType oauth, and string credential should succeed assert_equals: expected (string) "oauth" but got (undefined) undefined FAIL new RTCPeerConnection(config) - with stun server, credentialType password, and RTCOAuthCredential credential should succeed assert_equals: expected (string) "password" but got (undefined) undefined FAIL setConfiguration(config) - with stun server, credentialType password, and RTCOAuthCredential credential should succeed assert_equals: expected (string) "password" but got (undefined) undefined -FAIL new RTCPeerConnection(config) - with empty urls list, credentialType oauth, and string credential should succeed assert_equals: expected 1 but got 0 -FAIL setConfiguration(config) - with empty urls list, credentialType oauth, and string credential should succeed assert_equals: expected 1 but got 0 -FAIL new RTCPeerConnection(config) - with empty urls list, credentialType password, and RTCOAuthCredential credential should succeed assert_equals: expected 1 but got 0 -FAIL setConfiguration(config) - with empty urls list, credentialType password, and RTCOAuthCredential credential should succeed assert_equals: expected 1 but got 0 Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceServers.html b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceServers.html index 6069c25..3f5c367 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceServers.html +++ b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceServers.html
@@ -54,6 +54,10 @@ }, 'new RTCPeerConnection() should have default configuration.iceServers of undefined'); config_test(makePc => { + makePc({}); + }, '{} should succeed'); + + config_test(makePc => { assert_throws(new TypeError(), () => makePc({ iceServers: null })); }, '{ iceServers: null } should throw TypeError'); @@ -126,7 +130,7 @@ }, `with 2 stun servers should succeed`); config_test(makePc => { - const pc = new RTCPeerConnection({ iceServers: [{ + const pc = makePc({ iceServers: [{ urls: 'turn:turn.example.org', username: 'user', credential: 'cred' @@ -281,35 +285,49 @@ transport-ext = 1*unreserved */ config_test(makePc => { - assert_throws('SyntaxError', () => + assert_throws(new SyntaxError(), () => + makePc({ iceServers: [{ + urls: '' + }] })); + }, 'with "" url should throw SyntaxError'); + + config_test(makePc => { + assert_throws(new SyntaxError(), () => + makePc({ iceServers: [{ + urls: ['stun:stun1.example.net', ''] + }] })); + }, 'with ["stun:stun1.example.net", ""] url should throw SyntaxError'); + + config_test(makePc => { + assert_throws(new SyntaxError(), () => makePc({ iceServers: [{ urls: 'relative-url' }] })); }, 'with relative url should throw SyntaxError'); config_test(makePc => { - assert_throws('SyntaxError', () => + assert_throws(new SyntaxError(), () => makePc({ iceServers: [{ urls: 'http://example.com' }] })); }, 'with http url should throw SyntaxError'); config_test(makePc => { - assert_throws('SyntaxError', () => + assert_throws(new SyntaxError(), () => makePc({ iceServers: [{ urls: 'turn://example.org/foo?x=y' }] })); }, 'with invalid turn url should throw SyntaxError'); config_test(makePc => { - assert_throws('SyntaxError', () => + assert_throws(new SyntaxError(), () => makePc({ iceServers: [{ urls: 'stun://example.org/foo?x=y' }] })); }, 'with invalid stun url should throw SyntaxError'); config_test(makePc => { - assert_throws('SyntaxError', () => + assert_throws(new SyntaxError(), () => makePc({ iceServers: [{ urls: [] }] })); @@ -471,52 +489,6 @@ }, 'with stun server, credentialType password, and RTCOAuthCredential credential should succeed'); - // credential type validation is ignored when urls is empty and there is no scheme name - config_test(makePc => { - const pc = makePc({ iceServers: [{ - urls: [], - credentialType: 'oauth', - username: 'user', - credential: 'cred' - }] }); - - const { iceServers } = pc.getConfiguration(); - assert_equals(iceServers.length, 1); - const server = iceServers[0]; - - assert_array_equals(server.urls, []); - assert_equals(server.credentialType, 'oauth'); - assert_equals(server.username, 'user'); - assert_equals(server.credential, 'cred'); - - }, 'with empty urls list, credentialType oauth, and string credential should succeed'); - - // credential type validation is ignored when urls is empty and there is no scheme name - config_test(makePc => { - const pc = makePc({ iceServers: [{ - urls: [], - credentialType: 'password', - username: 'user', - credential: { - macKey: '', - accessToken: '' - } - }] }); - - const { iceServers } = pc.getConfiguration(); - assert_equals(iceServers.length, 1); - - const server = iceServers[0]; - assert_array_equals(server.urls, []); - assert_equals(server.credentialType, 'password'); - assert_equals(server.username, 'user'); - - const { credential } = server; - assert_equals(credential.macKey, ''); - assert_equals(credential.accessToken, ''); - - }, 'with empty urls list, credentialType password, and RTCOAuthCredential credential should succeed'); - /* Tested 4.3.2. To set a configuration
diff --git a/third_party/WebKit/LayoutTests/fast/animation/scroll-animations/scrolltimeline-parsing-scroll-offsets.html b/third_party/WebKit/LayoutTests/fast/animation/scroll-animations/scrolltimeline-parsing-scroll-offsets.html new file mode 100644 index 0000000..e5555da --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/animation/scroll-animations/scrolltimeline-parsing-scroll-offsets.html
@@ -0,0 +1,125 @@ +<!DOCTYPE html> +<style> +.scroller { + height: 100px; + width: 100px; + overflow: scroll; +} + +.content { + height: 500px; + width: 500px; +} +</style> + +<script src='../../../resources/testharness.js'></script> +<script src='../../../resources/testharnessreport.js'></script> + +<div class='scroller'> + <div class='content'></div> +</div> +<script> +const gValidScrollOffsetValues = [ + 'auto', + 0, + 'calc(100% - 80px)', +]; + +const gValidScrollOffsetSuffixes = [ + // Relative lengths. + 'em', + 'ex', + 'ch', + 'rem', + 'vw', + 'vh', + 'vmin', + 'vmax', + // Absolute lengths. + 'cm', + 'mm', + 'q', + 'in', + 'pc', + 'pt', + 'px', + // Percentage. + '%', +]; + +// These are deliberately incomplete, just a random sampling of invalid +// values/units. +const gInvalidScrollOffsetValues = [ + '', + 'calc(360deg / 4)', + 'left', + '#ff0000', + 'rgb(0, 128, 0)', + 'url("http://www.example.com/pinkish.gif")', + 'this_is_garbage', + // Multiple valid values. + '100px 5%', +]; + +const gInvalidScrollOffsetSuffixes = [ + 'deg', + 's', + 'Hz', + 'dpi', +]; + +// Positive tests. + +for (let offset of gValidScrollOffsetValues) { + test(function() { + const scroller = document.querySelector('.scroller'); + const scrollTimeline = new ScrollTimeline( + { scrollSource: scroller, timeRange: 100, + startScrollOffset: offset, endScrollOffset: offset }); + + // Special case for 0; this is a valid value, but like computed style will + // be output as '0px' when queried. + if (offset == 0) + offset = '0px'; + + assert_equals(scrollTimeline.startScrollOffset, offset); + assert_equals(scrollTimeline.endScrollOffset, offset); + }, '\'' + offset + '\' is a valid scroll offset value'); +} + +for (const suffix of gValidScrollOffsetSuffixes) { + test(function() { + const offset = '75' + suffix; + const scroller = document.querySelector('.scroller'); + const scrollTimeline = new ScrollTimeline( + { scrollSource: scroller, timeRange: 100, + startScrollOffset: offset, endScrollOffset: offset }); + + assert_equals(scrollTimeline.startScrollOffset, offset); + assert_equals(scrollTimeline.endScrollOffset, offset); + }, '\'' + suffix + '\' is a valid scroll offset unit'); +} + +// Negative tests. + +for (const offset of gInvalidScrollOffsetValues) { + test(function() { + const scroller = document.querySelector('.scroller'); + const constructorFunc = function() { new ScrollTimeline( + { scrollSource: scroller, timeRange: 100, + startScrollOffset: offset, endScrollOffset: offset }) }; + assert_throws(new TypeError(), constructorFunc); + }, '\'' + offset + '\' is an invalid scroll offset value'); +} + +for (const suffix of gInvalidScrollOffsetSuffixes) { + test(function() { + const offset = '75' + suffix; + const scroller = document.querySelector('.scroller'); + const constructorFunc = function() { new ScrollTimeline( + { scrollSource: scroller, timeRange: 100, + startScrollOffset: offset, endScrollOffset: offset }) }; + assert_throws(new TypeError(), constructorFunc); + }, '\'' + suffix + '\' is an invalid scroll offset unit'); +} +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/css/sticky/sticky-focus-after-scroll.html b/third_party/WebKit/LayoutTests/fast/css/sticky/sticky-focus-after-scroll.html new file mode 100644 index 0000000..8dfade7d --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/css/sticky/sticky-focus-after-scroll.html
@@ -0,0 +1,44 @@ +<!doctype html> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> +<select id="stickyEl" style="position:sticky;top:0px" > + <option>foo</option> + <option>bar</option> +</select> +<div> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +test<br>test<br>test<br>test<br>test<br>test<br>test<br> +</div> +<script> +'use strict'; + +test(() => { + var stickyEl = document.getElementById("stickyEl"); + window.scrollTo(0, document.body.scrollHeight); + assert_true(window.scrollY > 0); + var old_scroll_pos = window.scrollY; + stickyEl.focus(); + assert_equals(window.scrollY, old_scroll_pos, + "should not scroll up after focusing on sticky element"); +}); +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/events/no_hover_update_after_layout_change.html b/third_party/WebKit/LayoutTests/fast/events/no_hover_update_after_layout_change.html new file mode 100644 index 0000000..47f88daf --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/no_hover_update_after_layout_change.html
@@ -0,0 +1,56 @@ +<!DOCTYPE html> +<script src='../../resources/gesture-util.js'></script> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> + +<style> +#blue { + background-color: rgb(0, 0, 255); + position: absolute; + left: 75px; + top: 75px; + height: 100px; + width: 100px; +} +#blue:hover { + background-color: rgb(255, 255, 0); +} +</style> + +<script> +internals.runtimeFlags.noHoverAfterLayoutChangeEnabled = true; + +var eventList = []; +var x = 100; +var y = 100; +var addedBlue = false; + +function addBlue() { + document.body.innerHTML += '<div id="blue"></div>'; + var blue = document.getElementById("blue"); + var events = ['mouseover', 'mousemove', 'mouseout', 'mouseenter', 'mouseleave']; + events.forEach(function (event) { + blue.addEventListener(event, addMouseEvents); + }); + addedBlue = true; +} + +function checkMouseOverEvent() { + var result = eventList.join(); + assert_true(result == ''); + assert_equals(getComputedStyle(document.getElementById("blue")).backgroundColor, "rgb(0, 0, 255)"); + assert_true(internals.runtimeFlags.noHoverAfterLayoutChangeEnabled) +} + +function addMouseEvents(event) { + eventList.push(event.type); +} + +promise_test (async () => { + document.addEventListener('click', addBlue); + await mouseClickOn(x, y); + await waitFor(() => { return addedBlue; }); + await conditionHolds(() => { return addedBlue; }); + checkMouseOverEvent(); +}, 'Tests that the mouseover event is not fired and the element has no hover effect when the element underneath the mouse cursor is changed.'); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/geometry/transfrom-origin-on-zero-size-layer-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/geometry/transfrom-origin-on-zero-size-layer-expected.txt index 56dd5b0..7a6949b0 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/geometry/transfrom-origin-on-zero-size-layer-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/geometry/transfrom-origin-on-zero-size-layer-expected.txt
@@ -15,5 +15,5 @@ LayoutNGBlockFlow (positioned) {DIV} at (10,60) size 50x50 [bgcolor=#FF0000] layer at (10,10) size 0x0 LayoutNGBlockFlow (positioned) {DIV} at (10,10) size 0x0 -layer at (10,10) size 100x100 +layer at (10,60) size 50x50 LayoutNGBlockFlow (positioned) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/massive-scale-interest-rect-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/massive-scale-interest-rect-expected.txt deleted file mode 100644 index 1853f15d..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/massive-scale-interest-rect-expected.txt +++ /dev/null
@@ -1,13 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x108 - LayoutNGBlockFlow {HTML} at (0,0) size 800x108 - LayoutNGBlockFlow {BODY} at (8,8) size 784x92 -layer at (8,8) size 165x92 scrollHeight 1080 - LayoutNGBlockFlow {DIV} at (0,0) size 165x92 -layer at (8,8) size 1920x1080 backgroundClip at (8,8) size 165x92 clip at (8,8) size 165x92 - LayoutNGBlockFlow {DIV} at (0,0) size 1920x1080 [bgcolor=#0000FF] -layer at (8,5008) size 300x300 backgroundClip at (8,8) size 165x92 clip at (8,8) size 165x92 - LayoutNGBlockFlow (positioned) {DIV} at (0,5000) size 300x300 -layer at (8,5008) size 300x300 backgroundClip at (8,8) size 165x92 clip at (8,8) size 165x92 - LayoutNGBlockFlow (positioned) {DIV} at (0,5000) size 300x300
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/external/wpt/css/cssom/getComputedStyle-insets-absolute-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/external/wpt/css/cssom/getComputedStyle-insets-absolute-expected.txt new file mode 100644 index 0000000..205d1cd --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/external/wpt/css/cssom/getComputedStyle-insets-absolute-expected.txt
@@ -0,0 +1,328 @@ +This is a testharness.js-based test. +Found 324 tests; 192 PASS, 132 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS horizontal-tb ltr inside horizontal-tb ltr - Pixels resolve as-is +PASS horizontal-tb ltr inside horizontal-tb ltr - Relative lengths are absolutized into pixels +PASS horizontal-tb ltr inside horizontal-tb ltr - Percentages are absolutized into pixels +PASS horizontal-tb ltr inside horizontal-tb ltr - calc() is absolutized into pixels +PASS horizontal-tb ltr inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +PASS horizontal-tb ltr inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained +PASS horizontal-tb ltr inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb ltr inside horizontal-tb rtl - Pixels resolve as-is +PASS horizontal-tb ltr inside horizontal-tb rtl - Relative lengths are absolutized into pixels +PASS horizontal-tb ltr inside horizontal-tb rtl - Percentages are absolutized into pixels +PASS horizontal-tb ltr inside horizontal-tb rtl - calc() is absolutized into pixels +PASS horizontal-tb ltr inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +PASS horizontal-tb ltr inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained +PASS horizontal-tb ltr inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb ltr inside vertical-lr ltr - Pixels resolve as-is +PASS horizontal-tb ltr inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'left' expected "100px" but got "50px" +FAIL horizontal-tb ltr inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'left' expected "98px" but got "48px" +PASS horizontal-tb ltr inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'left' expected "400px" but got "200px" +PASS horizontal-tb ltr inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb ltr inside vertical-lr rtl - Pixels resolve as-is +PASS horizontal-tb ltr inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'left' expected "100px" but got "50px" +FAIL horizontal-tb ltr inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'left' expected "98px" but got "48px" +PASS horizontal-tb ltr inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'left' expected "400px" but got "200px" +PASS horizontal-tb ltr inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb ltr inside vertical-rl ltr - Pixels resolve as-is +PASS horizontal-tb ltr inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'left' expected "100px" but got "50px" +FAIL horizontal-tb ltr inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'left' expected "98px" but got "48px" +PASS horizontal-tb ltr inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'left' expected "400px" but got "200px" +FAIL horizontal-tb ltr inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL horizontal-tb ltr inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL horizontal-tb ltr inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS horizontal-tb ltr inside vertical-rl rtl - Pixels resolve as-is +PASS horizontal-tb ltr inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'left' expected "100px" but got "50px" +FAIL horizontal-tb ltr inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'left' expected "98px" but got "48px" +PASS horizontal-tb ltr inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'left' expected "400px" but got "200px" +FAIL horizontal-tb ltr inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL horizontal-tb ltr inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL horizontal-tb ltr inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS horizontal-tb rtl inside horizontal-tb ltr - Pixels resolve as-is +PASS horizontal-tb rtl inside horizontal-tb ltr - Relative lengths are absolutized into pixels +PASS horizontal-tb rtl inside horizontal-tb ltr - Percentages are absolutized into pixels +PASS horizontal-tb rtl inside horizontal-tb ltr - calc() is absolutized into pixels +PASS horizontal-tb rtl inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +PASS horizontal-tb rtl inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained +PASS horizontal-tb rtl inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb rtl inside horizontal-tb rtl - Pixels resolve as-is +PASS horizontal-tb rtl inside horizontal-tb rtl - Relative lengths are absolutized into pixels +PASS horizontal-tb rtl inside horizontal-tb rtl - Percentages are absolutized into pixels +PASS horizontal-tb rtl inside horizontal-tb rtl - calc() is absolutized into pixels +PASS horizontal-tb rtl inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +PASS horizontal-tb rtl inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained +PASS horizontal-tb rtl inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb rtl inside vertical-lr ltr - Pixels resolve as-is +PASS horizontal-tb rtl inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'left' expected "100px" but got "50px" +FAIL horizontal-tb rtl inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'left' expected "98px" but got "48px" +PASS horizontal-tb rtl inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'left' expected "400px" but got "200px" +PASS horizontal-tb rtl inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb rtl inside vertical-lr rtl - Pixels resolve as-is +PASS horizontal-tb rtl inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'left' expected "100px" but got "50px" +FAIL horizontal-tb rtl inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'left' expected "98px" but got "48px" +PASS horizontal-tb rtl inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'left' expected "400px" but got "200px" +PASS horizontal-tb rtl inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb rtl inside vertical-rl ltr - Pixels resolve as-is +PASS horizontal-tb rtl inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'left' expected "100px" but got "50px" +FAIL horizontal-tb rtl inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'left' expected "98px" but got "48px" +PASS horizontal-tb rtl inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'left' expected "400px" but got "200px" +FAIL horizontal-tb rtl inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL horizontal-tb rtl inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL horizontal-tb rtl inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS horizontal-tb rtl inside vertical-rl rtl - Pixels resolve as-is +PASS horizontal-tb rtl inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'left' expected "100px" but got "50px" +FAIL horizontal-tb rtl inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'left' expected "98px" but got "48px" +PASS horizontal-tb rtl inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'left' expected "400px" but got "200px" +FAIL horizontal-tb rtl inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL horizontal-tb rtl inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL horizontal-tb rtl inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS vertical-lr ltr inside horizontal-tb ltr - Pixels resolve as-is +PASS vertical-lr ltr inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr ltr inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr ltr inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-lr ltr inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr ltr inside horizontal-tb rtl - Pixels resolve as-is +PASS vertical-lr ltr inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr ltr inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr ltr inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-lr ltr inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr ltr inside vertical-lr ltr - Pixels resolve as-is +PASS vertical-lr ltr inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr ltr inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr ltr inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-lr ltr inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr ltr inside vertical-lr rtl - Pixels resolve as-is +PASS vertical-lr ltr inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr ltr inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr ltr inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-lr ltr inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr ltr inside vertical-rl ltr - Pixels resolve as-is +PASS vertical-lr ltr inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr ltr inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr ltr inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +FAIL vertical-lr ltr inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL vertical-lr ltr inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL vertical-lr ltr inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS vertical-lr ltr inside vertical-rl rtl - Pixels resolve as-is +PASS vertical-lr ltr inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr ltr inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr ltr inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +FAIL vertical-lr ltr inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL vertical-lr ltr inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL vertical-lr ltr inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS vertical-lr rtl inside horizontal-tb ltr - Pixels resolve as-is +PASS vertical-lr rtl inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr rtl inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr rtl inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-lr rtl inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr rtl inside horizontal-tb rtl - Pixels resolve as-is +PASS vertical-lr rtl inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr rtl inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr rtl inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-lr rtl inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr rtl inside vertical-lr ltr - Pixels resolve as-is +PASS vertical-lr rtl inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr rtl inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr rtl inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-lr rtl inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr rtl inside vertical-lr rtl - Pixels resolve as-is +PASS vertical-lr rtl inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr rtl inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr rtl inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-lr rtl inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr rtl inside vertical-rl ltr - Pixels resolve as-is +PASS vertical-lr rtl inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr rtl inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr rtl inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +FAIL vertical-lr rtl inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL vertical-lr rtl inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL vertical-lr rtl inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS vertical-lr rtl inside vertical-rl rtl - Pixels resolve as-is +PASS vertical-lr rtl inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-lr rtl inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-lr rtl inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +FAIL vertical-lr rtl inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL vertical-lr rtl inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL vertical-lr rtl inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS vertical-rl ltr inside horizontal-tb ltr - Pixels resolve as-is +PASS vertical-rl ltr inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl ltr inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl ltr inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-rl ltr inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl ltr inside horizontal-tb rtl - Pixels resolve as-is +PASS vertical-rl ltr inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl ltr inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl ltr inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-rl ltr inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl ltr inside vertical-lr ltr - Pixels resolve as-is +PASS vertical-rl ltr inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl ltr inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl ltr inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-rl ltr inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl ltr inside vertical-lr rtl - Pixels resolve as-is +PASS vertical-rl ltr inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl ltr inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl ltr inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-rl ltr inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl ltr inside vertical-rl ltr - Pixels resolve as-is +PASS vertical-rl ltr inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl ltr inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl ltr inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +FAIL vertical-rl ltr inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL vertical-rl ltr inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL vertical-rl ltr inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS vertical-rl ltr inside vertical-rl rtl - Pixels resolve as-is +PASS vertical-rl ltr inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl ltr inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl ltr inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +FAIL vertical-rl ltr inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL vertical-rl ltr inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL vertical-rl ltr inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS vertical-rl rtl inside horizontal-tb ltr - Pixels resolve as-is +PASS vertical-rl rtl inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl rtl inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl rtl inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-rl rtl inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl rtl inside horizontal-tb rtl - Pixels resolve as-is +PASS vertical-rl rtl inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl rtl inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl rtl inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-rl rtl inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl rtl inside vertical-lr ltr - Pixels resolve as-is +PASS vertical-rl rtl inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl rtl inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl rtl inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-rl rtl inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl rtl inside vertical-lr rtl - Pixels resolve as-is +PASS vertical-rl rtl inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl rtl inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl rtl inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +PASS vertical-rl rtl inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl rtl inside vertical-rl ltr - Pixels resolve as-is +PASS vertical-rl rtl inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl rtl inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl rtl inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +FAIL vertical-rl rtl inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL vertical-rl rtl inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL vertical-rl rtl inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +PASS vertical-rl rtl inside vertical-rl rtl - Pixels resolve as-is +PASS vertical-rl rtl inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "20px" but got "40px" +FAIL vertical-rl rtl inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "19px" but got "39px" +PASS vertical-rl rtl inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "200px" but got "400px" +FAIL vertical-rl rtl inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "396px" but got "4px" +FAIL vertical-rl rtl inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "398px" but got "2px" +FAIL vertical-rl rtl inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "370px" but got "30px" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/external/wpt/css/cssom/getComputedStyle-insets-fixed-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/external/wpt/css/cssom/getComputedStyle-insets-fixed-expected.txt new file mode 100644 index 0000000..d6d27674 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/external/wpt/css/cssom/getComputedStyle-insets-fixed-expected.txt
@@ -0,0 +1,328 @@ +This is a testharness.js-based test. +Found 324 tests; 180 PASS, 144 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS horizontal-tb ltr inside horizontal-tb ltr - Pixels resolve as-is +PASS horizontal-tb ltr inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "17.1875px" +FAIL horizontal-tb ltr inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "16.1875px" +PASS horizontal-tb ltr inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "172px" +PASS horizontal-tb ltr inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb ltr inside horizontal-tb rtl - Pixels resolve as-is +PASS horizontal-tb ltr inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "17.1875px" +FAIL horizontal-tb ltr inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "16.1875px" +PASS horizontal-tb ltr inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "172px" +PASS horizontal-tb ltr inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb ltr inside vertical-lr ltr - Pixels resolve as-is +PASS horizontal-tb ltr inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "4.39062px" +FAIL horizontal-tb ltr inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "3.39062px" +PASS horizontal-tb ltr inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "44px" +PASS horizontal-tb ltr inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb ltr inside vertical-lr rtl - Pixels resolve as-is +PASS horizontal-tb ltr inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "4.39062px" +FAIL horizontal-tb ltr inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "3.39062px" +PASS horizontal-tb ltr inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "44px" +PASS horizontal-tb ltr inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb ltr inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb ltr inside vertical-rl ltr - Pixels resolve as-is +PASS horizontal-tb ltr inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "4.39062px" +FAIL horizontal-tb ltr inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "3.39062px" +PASS horizontal-tb ltr inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "44px" +FAIL horizontal-tb ltr inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL horizontal-tb ltr inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL horizontal-tb ltr inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS horizontal-tb ltr inside vertical-rl rtl - Pixels resolve as-is +PASS horizontal-tb ltr inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb ltr inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "4.39062px" +FAIL horizontal-tb ltr inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "3.39062px" +PASS horizontal-tb ltr inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb ltr inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "44px" +FAIL horizontal-tb ltr inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL horizontal-tb ltr inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL horizontal-tb ltr inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS horizontal-tb rtl inside horizontal-tb ltr - Pixels resolve as-is +PASS horizontal-tb rtl inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "17.1875px" +FAIL horizontal-tb rtl inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "16.1875px" +PASS horizontal-tb rtl inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "172px" +PASS horizontal-tb rtl inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb rtl inside horizontal-tb rtl - Pixels resolve as-is +PASS horizontal-tb rtl inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "17.1875px" +FAIL horizontal-tb rtl inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "16.1875px" +PASS horizontal-tb rtl inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "172px" +PASS horizontal-tb rtl inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb rtl inside vertical-lr ltr - Pixels resolve as-is +PASS horizontal-tb rtl inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "4.39062px" +FAIL horizontal-tb rtl inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "3.39062px" +PASS horizontal-tb rtl inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "44px" +PASS horizontal-tb rtl inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb rtl inside vertical-lr rtl - Pixels resolve as-is +PASS horizontal-tb rtl inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "4.39062px" +FAIL horizontal-tb rtl inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "3.39062px" +PASS horizontal-tb rtl inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "44px" +PASS horizontal-tb rtl inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS horizontal-tb rtl inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS horizontal-tb rtl inside vertical-rl ltr - Pixels resolve as-is +PASS horizontal-tb rtl inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "4.39062px" +FAIL horizontal-tb rtl inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "3.39062px" +PASS horizontal-tb rtl inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "44px" +FAIL horizontal-tb rtl inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL horizontal-tb rtl inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL horizontal-tb rtl inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS horizontal-tb rtl inside vertical-rl rtl - Pixels resolve as-is +PASS horizontal-tb rtl inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL horizontal-tb rtl inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "4.39062px" +FAIL horizontal-tb rtl inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "3.39062px" +PASS horizontal-tb rtl inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL horizontal-tb rtl inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "44px" +FAIL horizontal-tb rtl inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL horizontal-tb rtl inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL horizontal-tb rtl inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS vertical-lr ltr inside horizontal-tb ltr - Pixels resolve as-is +PASS vertical-lr ltr inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "47.1875px" +FAIL vertical-lr ltr inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "46.1875px" +PASS vertical-lr ltr inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "472px" +PASS vertical-lr ltr inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr ltr inside horizontal-tb rtl - Pixels resolve as-is +PASS vertical-lr ltr inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "47.1875px" +FAIL vertical-lr ltr inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "46.1875px" +PASS vertical-lr ltr inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "472px" +PASS vertical-lr ltr inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr ltr inside vertical-lr ltr - Pixels resolve as-is +PASS vertical-lr ltr inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-lr ltr inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-lr ltr inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +PASS vertical-lr ltr inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr ltr inside vertical-lr rtl - Pixels resolve as-is +PASS vertical-lr ltr inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-lr ltr inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-lr ltr inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +PASS vertical-lr ltr inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr ltr inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr ltr inside vertical-rl ltr - Pixels resolve as-is +PASS vertical-lr ltr inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-lr ltr inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-lr ltr inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +FAIL vertical-lr ltr inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL vertical-lr ltr inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL vertical-lr ltr inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS vertical-lr ltr inside vertical-rl rtl - Pixels resolve as-is +PASS vertical-lr ltr inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr ltr inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-lr ltr inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-lr ltr inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr ltr inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +FAIL vertical-lr ltr inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL vertical-lr ltr inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL vertical-lr ltr inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS vertical-lr rtl inside horizontal-tb ltr - Pixels resolve as-is +PASS vertical-lr rtl inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "47.1875px" +FAIL vertical-lr rtl inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "46.1875px" +PASS vertical-lr rtl inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "472px" +PASS vertical-lr rtl inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr rtl inside horizontal-tb rtl - Pixels resolve as-is +PASS vertical-lr rtl inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "47.1875px" +FAIL vertical-lr rtl inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "46.1875px" +PASS vertical-lr rtl inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "472px" +PASS vertical-lr rtl inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr rtl inside vertical-lr ltr - Pixels resolve as-is +PASS vertical-lr rtl inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-lr rtl inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-lr rtl inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +PASS vertical-lr rtl inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr rtl inside vertical-lr rtl - Pixels resolve as-is +PASS vertical-lr rtl inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-lr rtl inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-lr rtl inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +PASS vertical-lr rtl inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-lr rtl inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-lr rtl inside vertical-rl ltr - Pixels resolve as-is +PASS vertical-lr rtl inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-lr rtl inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-lr rtl inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +FAIL vertical-lr rtl inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL vertical-lr rtl inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL vertical-lr rtl inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS vertical-lr rtl inside vertical-rl rtl - Pixels resolve as-is +PASS vertical-lr rtl inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL vertical-lr rtl inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-lr rtl inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-lr rtl inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL vertical-lr rtl inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +FAIL vertical-lr rtl inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL vertical-lr rtl inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL vertical-lr rtl inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS vertical-rl ltr inside horizontal-tb ltr - Pixels resolve as-is +PASS vertical-rl ltr inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "47.1875px" +FAIL vertical-rl ltr inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "46.1875px" +PASS vertical-rl ltr inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "472px" +PASS vertical-rl ltr inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl ltr inside horizontal-tb rtl - Pixels resolve as-is +PASS vertical-rl ltr inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "47.1875px" +FAIL vertical-rl ltr inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "46.1875px" +PASS vertical-rl ltr inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "472px" +PASS vertical-rl ltr inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl ltr inside vertical-lr ltr - Pixels resolve as-is +PASS vertical-rl ltr inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-rl ltr inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-rl ltr inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +PASS vertical-rl ltr inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl ltr inside vertical-lr rtl - Pixels resolve as-is +PASS vertical-rl ltr inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-rl ltr inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-rl ltr inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +PASS vertical-rl ltr inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl ltr inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl ltr inside vertical-rl ltr - Pixels resolve as-is +PASS vertical-rl ltr inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-rl ltr inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-rl ltr inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +FAIL vertical-rl ltr inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL vertical-rl ltr inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL vertical-rl ltr inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS vertical-rl ltr inside vertical-rl rtl - Pixels resolve as-is +PASS vertical-rl ltr inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl ltr inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-rl ltr inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-rl ltr inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl ltr inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +FAIL vertical-rl ltr inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL vertical-rl ltr inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL vertical-rl ltr inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS vertical-rl rtl inside horizontal-tb ltr - Pixels resolve as-is +PASS vertical-rl rtl inside horizontal-tb ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside horizontal-tb ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "47.1875px" +FAIL vertical-rl rtl inside horizontal-tb ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "46.1875px" +PASS vertical-rl rtl inside horizontal-tb ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside horizontal-tb ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "472px" +PASS vertical-rl rtl inside horizontal-tb ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside horizontal-tb ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside horizontal-tb ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl rtl inside horizontal-tb rtl - Pixels resolve as-is +PASS vertical-rl rtl inside horizontal-tb rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside horizontal-tb rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "47.1875px" +FAIL vertical-rl rtl inside horizontal-tb rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "46.1875px" +PASS vertical-rl rtl inside horizontal-tb rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside horizontal-tb rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "472px" +PASS vertical-rl rtl inside horizontal-tb rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside horizontal-tb rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside horizontal-tb rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl rtl inside vertical-lr ltr - Pixels resolve as-is +PASS vertical-rl rtl inside vertical-lr ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside vertical-lr ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-rl rtl inside vertical-lr ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-rl rtl inside vertical-lr ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside vertical-lr ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +PASS vertical-rl rtl inside vertical-lr ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside vertical-lr ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside vertical-lr ltr - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl rtl inside vertical-lr rtl - Pixels resolve as-is +PASS vertical-rl rtl inside vertical-lr rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside vertical-lr rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-rl rtl inside vertical-lr rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-rl rtl inside vertical-lr rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside vertical-lr rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +PASS vertical-rl rtl inside vertical-lr rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside vertical-lr rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value +PASS vertical-rl rtl inside vertical-lr rtl - If opposite sides are 'auto', they resolve to used value +PASS vertical-rl rtl inside vertical-rl ltr - Pixels resolve as-is +PASS vertical-rl rtl inside vertical-rl ltr - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside vertical-rl ltr - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-rl rtl inside vertical-rl ltr - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-rl rtl inside vertical-rl ltr - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside vertical-rl ltr - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +FAIL vertical-rl rtl inside vertical-rl ltr - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL vertical-rl rtl inside vertical-rl ltr - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL vertical-rl rtl inside vertical-rl ltr - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +PASS vertical-rl rtl inside vertical-rl rtl - Pixels resolve as-is +PASS vertical-rl rtl inside vertical-rl rtl - Relative lengths are absolutized into pixels +FAIL vertical-rl rtl inside vertical-rl rtl - Percentages are absolutized into pixels assert_equals: 'top' expected "30px" but got "34.3906px" +FAIL vertical-rl rtl inside vertical-rl rtl - calc() is absolutized into pixels assert_equals: 'top' expected "29px" but got "33.3906px" +PASS vertical-rl rtl inside vertical-rl rtl - Pixels resolve as-is when overconstrained +FAIL vertical-rl rtl inside vertical-rl rtl - Percentages absolutize the computed value when overconstrained assert_equals: 'top' expected "300px" but got "344px" +FAIL vertical-rl rtl inside vertical-rl rtl - If start side is 'auto' and end side is not, 'auto' resolves to used value assert_equals: 'left' expected "596px" but got "4px" +FAIL vertical-rl rtl inside vertical-rl rtl - If end side is 'auto' and start side is not, 'auto' resolves to used value assert_equals: 'right' expected "598px" but got "2px" +FAIL vertical-rl rtl inside vertical-rl rtl - If opposite sides are 'auto', they resolve to used value assert_equals: 'left' expected "346px" but got "254px" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/.htaccess b/third_party/WebKit/LayoutTests/http/tests/devtools/.htaccess new file mode 100644 index 0000000..54e40c57 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/.htaccess
@@ -0,0 +1,7 @@ +# devtools tests request http[s] resources from file:// origin. Let +# the tests access the resources. +Header set Access-Control-Allow-Origin "*" + +<FilesMatch "\.(cgi)$"> + Header unset Access-Control-Allow-Origin +</FilesMatch>
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-expected.txt index 648886b..fb1e888 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-expected.txt
@@ -40,14 +40,14 @@ (anonymous) @ VM:1 Message count: 3 -console-xhr-logging.js:13 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html -VM:37 Access to XMLHttpRequest at 'http://localhost:8000/devtools/resources/xhr-exists.html' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. +console-xhr-logging.js:13 sending a GET request to http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html +VM:37 Access to XMLHttpRequest at 'http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. makeXHR @ VM:37 makeSimpleXHRWithPayload @ VM:13 makeSimpleXHR @ VM:9 requestHelper @ console-xhr-logging.js:14 (anonymous) @ VM:1 -VM:37 XHR finished loading: GET "http://localhost:8000/devtools/resources/xhr-exists.html". +VM:37 XHR finished loading: GET "http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html". makeXHR @ VM:37 makeSimpleXHRWithPayload @ VM:13 makeSimpleXHR @ VM:9 @@ -70,8 +70,8 @@ console-xhr-logging.js:13 sending a POST request to resources/post-target.cgi Message count: 2 -console-xhr-logging.js:13 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html -VM:37 Access to XMLHttpRequest at 'http://localhost:8000/devtools/resources/xhr-exists.html' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. +console-xhr-logging.js:13 sending a GET request to http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html +VM:37 Access to XMLHttpRequest at 'http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. makeXHR @ VM:37 makeSimpleXHRWithPayload @ VM:13 makeSimpleXHR @ VM:9
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging.js b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging.js index 9ff36af..936a6d3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging.js
@@ -35,7 +35,7 @@ SDK.consoleModel.requestClearMessages(); TestRunner.addResult(''); - TestRunner.evaluateInPageAsync(`requestHelper('GET', 'http://localhost:8000/devtools/resources/xhr-exists.html')`); + TestRunner.evaluateInPageAsync(`requestHelper('GET', 'http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html')`); await ConsoleTestRunner.waitForConsoleMessagesPromise(3); ConsoleTestRunner.dumpConsoleMessages(); SDK.consoleModel.requestClearMessages(); @@ -61,7 +61,7 @@ SDK.consoleModel.requestClearMessages(); TestRunner.addResult(''); - TestRunner.evaluateInPageAsync(`requestHelper('GET', 'http://localhost:8000/devtools/resources/xhr-exists.html')`); + TestRunner.evaluateInPageAsync(`requestHelper('GET', 'http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html')`); await ConsoleTestRunner.waitForConsoleMessagesPromise(2); ConsoleTestRunner.dumpConsoleMessages(); SDK.consoleModel.requestClearMessages();
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resources/cors-disabled/.htaccess b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/cors-disabled/.htaccess new file mode 100644 index 0000000..a6aa3447 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/cors-disabled/.htaccess
@@ -0,0 +1,2 @@ +Header unset Access-Control-Allow-Origin +
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resources/cors-disabled/xhr-exists.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/cors-disabled/xhr-exists.html new file mode 100644 index 0000000..8631aea --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/cors-disabled/xhr-exists.html
@@ -0,0 +1 @@ +<p>Existing File</p>
diff --git a/third_party/WebKit/LayoutTests/http/tests/dom/eventlistener-with-remote-context.html b/third_party/WebKit/LayoutTests/http/tests/dom/eventlistener-with-remote-context.html new file mode 100644 index 0000000..0f8b5209 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/dom/eventlistener-with-remote-context.html
@@ -0,0 +1,21 @@ +<!doctype html> +<meta charset="utf-8"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<iframe src="http://localhost:8080/resources/dummy.html" id="likely_remote_frame"></iframe> +<script> +let likelyRemoteFrame = document.getElementById('likely_remote_frame'); +likelyRemoteFrame.onload = function() { + +test(function() { + let likelyRemoteWindow = likelyRemoteFrame.contentWindow; + try { + // |likelyRemoteWindow| is likely to be a remote window and to not have + // an associated v8::Context. The code below must not crash even in such + // a case. Site-per-process makes this test easier to fail. + window.addEventListener('click', likelyRemoteWindow); + } catch (e) {} +}, "EventListener doesn't crash with a remote object."); + +}; // likelyRemoteFrame.onload = function() +</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/call-extra-crash-construct-and-look.html b/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/call-extra-crash-construct-and-look.html index 207f041..7b2b3c2 100644 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/call-extra-crash-construct-and-look.html +++ b/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/call-extra-crash-construct-and-look.html
@@ -6,6 +6,6 @@ test(() => { let response; fillStackAndRun(() => response = new Response('hi')); - assert_equals(response.body, undefined, 'response body should be undefined'); -}, 'stack overflow in Response constructor should lead to an undefined body'); + assert_equals(response.body instanceof ReadableStream, true, 'response body should be ReadableStream'); +}, 'stack overflow in Response constructor should not crash the browser'); </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/call-extra-crash-is-disturbed.html b/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/call-extra-crash-is-disturbed.html index 9e54781..dc62677 100644 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/call-extra-crash-is-disturbed.html +++ b/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/call-extra-crash-is-disturbed.html
@@ -6,8 +6,6 @@ test(() => { const rs = new ReadableStream(); const response = new Response(rs); - assert_throws("InvalidStateError", - () => fillStackAndRun(() => response.bodyUsed), - 'getter should throw a DOMException'); + fillStackAndRun(() => response.bodyUsed) }, 'stack overflow in bodyUsed should not crash the browser'); </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response.js index d8241227..5bbc36c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response.js +++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response.js
@@ -480,6 +480,14 @@ assert_equals(response.body, stream); }, 'Response constructed with a stream'); +test(() => { + var controller; + var stream = new ReadableStream({start: c => controller = c}); + stream.getReader(); + assert_throws(TypeError(), () => new Response(stream), + 'Response constructor should throw TypeError'); + }, 'Response constructed with a locked stream'); + promise_test(() => { var controller; var stream = new ReadableStream({start: c => controller = c}); @@ -542,14 +550,6 @@ promise_test(t => { var controller; var stream = new ReadableStream({start: c => controller = c}); - stream.getReader(); - var response = new Response(stream); - return promise_rejects(t, TypeError(), response.text()); - }, 'Response constructed with a locked stream'); - -promise_test(t => { - var controller; - var stream = new ReadableStream({start: c => controller = c}); setTimeout(() => controller.enqueue(), 1); var response = new Response(stream); return promise_rejects(t, TypeError(), response.text());
diff --git a/third_party/WebKit/LayoutTests/http/tests/resources/file-last-modified.php b/third_party/WebKit/LayoutTests/http/tests/resources/file-last-modified.php index efcf950..8763dcb4 100644 --- a/third_party/WebKit/LayoutTests/http/tests/resources/file-last-modified.php +++ b/third_party/WebKit/LayoutTests/http/tests/resources/file-last-modified.php
@@ -1,4 +1,5 @@ <?php +header('Access-Control-Allow-Origin: *'); date_default_timezone_set('UTC'); $filePath = $_GET['path']; if (file_exists($filePath)) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/resources/post-and-verify-hybrid.cgi b/third_party/WebKit/LayoutTests/http/tests/resources/post-and-verify-hybrid.cgi index 9b2bf98..c45ad853 100755 --- a/third_party/WebKit/LayoutTests/http/tests/resources/post-and-verify-hybrid.cgi +++ b/third_party/WebKit/LayoutTests/http/tests/resources/post-and-verify-hybrid.cgi
@@ -2,9 +2,15 @@ use Config; -print "Content-type: text/plain\n\n"; +print "Access-Control-Allow-Origin: *\n"; -if ($ENV{'REQUEST_METHOD'} eq "POST") { +if ($ENV{'REQUEST_METHOD'} eq "OPTIONS") { + # CORS preflight + print "Access-Control-Allow-Headers: *\n"; + print "\n" +} elsif ($ENV{'REQUEST_METHOD'} eq "POST") { + print "Content-type: text/plain\n\n"; + if ($ENV{'CONTENT_LENGTH'}) { read(STDIN, $postData, $ENV{'CONTENT_LENGTH'}) || die "Could not get post data\n"; } else { @@ -82,5 +88,6 @@ print "FAILED"; } } else { + print "Content-type: text/plain\n\n"; print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n"; }
diff --git a/third_party/WebKit/LayoutTests/http/tests/resources/post-and-verify.cgi b/third_party/WebKit/LayoutTests/http/tests/resources/post-and-verify.cgi index 5ff6109..e1e574d 100755 --- a/third_party/WebKit/LayoutTests/http/tests/resources/post-and-verify.cgi +++ b/third_party/WebKit/LayoutTests/http/tests/resources/post-and-verify.cgi
@@ -1,8 +1,13 @@ #!/usr/bin/perl -wT -print "Content-type: text/plain\n\n"; +print "Access-Control-Allow-Origin: *\n"; -if ($ENV{'REQUEST_METHOD'} eq "POST") { +if ($ENV{'REQUEST_METHOD'} eq "OPTIONS") { + # CORS preflight + print "Access-Control-Allow-Headers: *\n"; + print "\n"; +} elsif ($ENV{'REQUEST_METHOD'} eq "POST") { + print "Content-type: text/plain\n\n"; if ($ENV{'CONTENT_LENGTH'}) { read(STDIN, $postData, $ENV{'CONTENT_LENGTH'}) || die "Could not get post data\n"; } else { @@ -26,5 +31,6 @@ print "FAILED"; } } else { + print "Content-type: text/plain\n\n"; print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n"; -} +}
diff --git a/third_party/WebKit/LayoutTests/http/tests/resources/reset-temp-file.php b/third_party/WebKit/LayoutTests/http/tests/resources/reset-temp-file.php index 186376b5..35e697c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/resources/reset-temp-file.php +++ b/third_party/WebKit/LayoutTests/http/tests/resources/reset-temp-file.php
@@ -1,5 +1,6 @@ <?php require_once 'portabilityLayer.php'; +header('Access-Control-Allow-Origin: *'); if (!sys_get_temp_dir()) { echo "FAIL: No temp dir was returned.\n";
diff --git a/third_party/WebKit/LayoutTests/http/tests/resources/touch-temp-file.php b/third_party/WebKit/LayoutTests/http/tests/resources/touch-temp-file.php index ed5abca0..dac6990 100644 --- a/third_party/WebKit/LayoutTests/http/tests/resources/touch-temp-file.php +++ b/third_party/WebKit/LayoutTests/http/tests/resources/touch-temp-file.php
@@ -1,5 +1,6 @@ <?php require_once 'portabilityLayer.php'; +header("Access-Control-Allow-Origin: *"); if (!sys_get_temp_dir()) { echo "FAIL: No temp dir was returned.\n";
diff --git a/third_party/WebKit/LayoutTests/http/tests/resources/write-temp-file.php b/third_party/WebKit/LayoutTests/http/tests/resources/write-temp-file.php index 7abe358..6514d80c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/resources/write-temp-file.php +++ b/third_party/WebKit/LayoutTests/http/tests/resources/write-temp-file.php
@@ -1,6 +1,8 @@ <?php require_once 'portabilityLayer.php'; +header('Access-Control-Allow-Origin: *'); + if (!sys_get_temp_dir()) { echo "FAIL: No temp dir was returned.\n"; exit();
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo-filenames.php b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo-filenames.php index c79cce9..1017e77 100644 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo-filenames.php +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo-filenames.php
@@ -1,4 +1,5 @@ <?php +header('Access-Control-Allow-Origin: *'); $first = True; foreach ($_FILES as $file) { if (!$first)
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo.php b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo.php index 4b0ac10..eda1de8c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo.php +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo.php
@@ -1,4 +1,5 @@ <?php +header('Access-Control-Allow-Origin: *'); if (strpos($_SERVER['CONTENT_TYPE'], 'multipart/form-data; boundary=') != 0) { echo 'Invalid Content-Types.'; return;
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/post-echo.cgi b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/post-echo.cgi index 07a8818..06d61d9 100755 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/post-echo.cgi +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/post-echo.cgi
@@ -1,6 +1,7 @@ #!/usr/bin/perl -wT -print "Content-type: text/plain\n\n"; +print "Access-Control-Allow-Origin: *\n"; +print "Content-type: text/plain\n\n"; if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $request, $ENV{'CONTENT_LENGTH'}) @@ -8,4 +9,4 @@ print $request; } else { print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n"; -} +}
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/post-echo.php b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/post-echo.php index 8d18066..22187aee 100644 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/post-echo.php +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/post-echo.php
@@ -1,4 +1,5 @@ <?php +header('Access-Control-Allow-Origin: *'); if (isset($_POST['type'])) header("Content-Type: {$_POST['type']}"); else
diff --git a/third_party/WebKit/LayoutTests/platform/linux/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt index fc743f1c..23487b4 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt
@@ -1,11 +1,11 @@ This is a testharness.js-based test. -FAIL .table assert_equals: .table display expected "table" but got "block" +FAIL .table assert_equals: .table height expected "40px" but got "60px" FAIL .caption assert_equals: .caption display expected "table-caption" but got "block" FAIL .col assert_equals: .col display expected "table-column" but got "block" FAIL .tbody assert_equals: .tbody display expected "table-row-group" but got "block" FAIL .tr assert_equals: .tr display expected "table-row" but got "block" FAIL .td assert_equals: .td display expected "table-cell" but got "block" -FAIL .li assert_equals: .li display expected "list-item" but got "block" +PASS .li FAIL .inline assert_equals: .inline display expected "inline" but got "block" FAIL .inline-block assert_equals: .inline-block display expected "inline-block" but got "block" FAIL .ruby assert_equals: .ruby display expected "inline" but got "block"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt deleted file mode 100644 index e143595..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -FAIL flex assert_equals: offsetHeight expected 18 but got 36 -FAIL inline-flex assert_equals: offsetHeight expected 18 but got 36 -FAIL grid assert_equals: offsetHeight expected 18 but got 36 -FAIL inline-grid assert_equals: offsetHeight expected 18 but got 36 -PASS multicol -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt index fe9759b..9dded24 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt
@@ -1,11 +1,11 @@ This is a testharness.js-based test. -FAIL .table assert_equals: .table display expected "table" but got "block" +FAIL .table assert_equals: .table height expected "36px" but got "54px" FAIL .caption assert_equals: .caption display expected "table-caption" but got "block" FAIL .col assert_equals: .col display expected "table-column" but got "block" FAIL .tbody assert_equals: .tbody display expected "table-row-group" but got "block" FAIL .tr assert_equals: .tr display expected "table-row" but got "block" FAIL .td assert_equals: .td display expected "table-cell" but got "block" -FAIL .li assert_equals: .li display expected "list-item" but got "block" +PASS .li FAIL .inline assert_equals: .inline display expected "inline" but got "block" FAIL .inline-block assert_equals: .inline-block display expected "inline-block" but got "block" FAIL .ruby assert_equals: .ruby display expected "inline" but got "block"
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt deleted file mode 100644 index 08a8223f..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -FAIL flex assert_equals: offsetHeight expected 20 but got 40 -FAIL inline-flex assert_equals: offsetHeight expected 20 but got 40 -FAIL grid assert_equals: offsetHeight expected 20 but got 40 -FAIL inline-grid assert_equals: offsetHeight expected 20 but got 40 -PASS multicol -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt index e6626e3..92174a8 100644 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt
@@ -1,11 +1,11 @@ This is a testharness.js-based test. -FAIL .table assert_equals: .table display expected "table" but got "block" +FAIL .table assert_equals: .table height expected "40px" but got "60px" FAIL .caption assert_equals: .caption display expected "table-caption" but got "block" FAIL .col assert_equals: .col display expected "table-column" but got "block" FAIL .tbody assert_equals: .tbody display expected "table-row-group" but got "block" FAIL .tr assert_equals: .tr display expected "table-row" but got "block" FAIL .td assert_equals: .td display expected "table-cell" but got "block" -FAIL .li assert_equals: .li display expected "list-item" but got "block" +PASS .li FAIL .inline assert_equals: .inline display expected "inline" but got "block" FAIL .inline-block assert_equals: .inline-block display expected "inline-block" but got "block" FAIL .ruby assert_equals: .ruby display expected "inline" but got "block"
diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/fast/events/touch/README.txt b/third_party/WebKit/LayoutTests/virtual/threaded/fast/events/touch/README.txt deleted file mode 100644 index 389a442a..0000000 --- a/third_party/WebKit/LayoutTests/virtual/threaded/fast/events/touch/README.txt +++ /dev/null
@@ -1,2 +0,0 @@ -# This suite runs the tests in fast/events/touch with -# --enable-threaded-compositing \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/fast/events/wheel/README.txt b/third_party/WebKit/LayoutTests/virtual/threaded/fast/events/wheel/README.txt deleted file mode 100644 index f5d94365..0000000 --- a/third_party/WebKit/LayoutTests/virtual/threaded/fast/events/wheel/README.txt +++ /dev/null
@@ -1,2 +0,0 @@ -# This suite runs the tests in fast/events/wheel with -# --enable-threaded-compositing \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index 9d92586..719c056 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -6871,8 +6871,10 @@ setter onaudioprocess interface ScrollTimeline : AnimationTimeline attribute @@toStringTag + getter endScrollOffset getter orientation getter scrollSource + getter startScrollOffset getter timeRange method constructor interface SecurityPolicyViolationEvent : Event
diff --git a/third_party/blink/common/messaging/cloneable_message.cc b/third_party/blink/common/messaging/cloneable_message.cc index a2076ae..610a51b 100644 --- a/third_party/blink/common/messaging/cloneable_message.cc +++ b/third_party/blink/common/messaging/cloneable_message.cc
@@ -5,7 +5,7 @@ #include "third_party/blink/public/common/messaging/cloneable_message.h" #include "third_party/blink/public/mojom/blob/blob.mojom.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom.h" +#include "third_party/blink/public/mojom/messaging/cloneable_message.mojom.h" namespace blink {
diff --git a/third_party/blink/common/messaging/cloneable_message.typemap b/third_party/blink/common/messaging/cloneable_message.typemap index 790a1e1..ad21a73 100644 --- a/third_party/blink/common/messaging/cloneable_message.typemap +++ b/third_party/blink/common/messaging/cloneable_message.typemap
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/blink/public/mojom/messaging/message_port.mojom" +mojom = "//third_party/blink/public/mojom/messaging/cloneable_message.mojom" public_headers = [ "//third_party/blink/public/common/messaging/cloneable_message.h" ] traits_headers =
diff --git a/third_party/blink/common/messaging/cloneable_message_struct_traits.h b/third_party/blink/common/messaging/cloneable_message_struct_traits.h index 0b20cf4..7d197df 100644 --- a/third_party/blink/common/messaging/cloneable_message_struct_traits.h +++ b/third_party/blink/common/messaging/cloneable_message_struct_traits.h
@@ -8,7 +8,7 @@ #include "mojo/public/cpp/base/big_buffer.h" #include "mojo/public/cpp/base/unguessable_token_mojom_traits.h" #include "third_party/blink/public/common/messaging/cloneable_message.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom.h" +#include "third_party/blink/public/mojom/messaging/cloneable_message.mojom.h" namespace mojo {
diff --git a/third_party/blink/common/messaging/transferable_message.typemap b/third_party/blink/common/messaging/transferable_message.typemap index 290f8fab..0229ba5 100644 --- a/third_party/blink/common/messaging/transferable_message.typemap +++ b/third_party/blink/common/messaging/transferable_message.typemap
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/blink/public/mojom/messaging/message_port.mojom" +mojom = "//third_party/blink/public/mojom/messaging/transferable_message.mojom" public_headers = [ "//third_party/blink/public/common/messaging/transferable_message.h", "//third_party/blink/public/common/messaging/message_port_channel.h",
diff --git a/third_party/blink/common/messaging/transferable_message_struct_traits.h b/third_party/blink/common/messaging/transferable_message_struct_traits.h index 434d205c..04e189d 100644 --- a/third_party/blink/common/messaging/transferable_message_struct_traits.h +++ b/third_party/blink/common/messaging/transferable_message_struct_traits.h
@@ -8,7 +8,7 @@ #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h" #include "third_party/blink/common/messaging/cloneable_message_struct_traits.h" #include "third_party/blink/public/common/messaging/transferable_message.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom.h" +#include "third_party/blink/public/mojom/messaging/transferable_message.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" namespace mojo {
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index c41fb620..6b3bfe4c 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -177,7 +177,6 @@ "platform/modules/service_worker/web_service_worker_registration_proxy.h", "platform/modules/service_worker/web_service_worker_request.h", "platform/modules/service_worker/web_service_worker_response.h", - "platform/modules/service_worker/web_service_worker_skip_waiting_callbacks.h", "platform/modules/service_worker/web_service_worker_stream_handle.h", "platform/modules/webmidi/web_midi_accessor.h", "platform/modules/webmidi/web_midi_accessor_client.h",
diff --git a/third_party/blink/public/common/messaging/transferable_message.h b/third_party/blink/public/common/messaging/transferable_message.h index 5f250c0..6b61c13 100644 --- a/third_party/blink/public/common/messaging/transferable_message.h +++ b/third_party/blink/public/common/messaging/transferable_message.h
@@ -26,12 +26,12 @@ TransferableMessage& operator=(TransferableMessage&&); ~TransferableMessage(); - // Any ports being transfered as part of this message. + // Any ports being transferred as part of this message. std::vector<MessagePortChannel> ports; - // The contents of any ArrayBuffers being transfered as part of this message. + // The contents of any ArrayBuffers being transferred as part of this message. std::vector<mojom::SerializedArrayBufferContentsPtr> array_buffer_contents_array; - // The contents of any ImageBitmaps being transfered as part of this message. + // The contents of any ImageBitmaps being transferred as part of this message. std::vector<SkBitmap> image_bitmap_contents_array; // Whether the recipient should have a user gesture when it processes this
diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn index 7d92cbb..60ab65d 100644 --- a/third_party/blink/public/mojom/BUILD.gn +++ b/third_party/blink/public/mojom/BUILD.gn
@@ -128,7 +128,7 @@ # typemapped to a type in Source/core. This also means these interfaces are not # available from Source/platform. # Note that service_worker_object.mojom and service_worker.mojom depend -# on message_port.mojom, and service_worker_registration.mojom depends +# on transferable_message.mojom, and service_worker_registration.mojom depends # on service_worker_object.mojom, so we put these three service worker # mojom files here rather than mojom_platform target. # In future we may have a separate mojom target for the things that may have @@ -136,7 +136,8 @@ # those high-level service worker mojom files there. mojom("mojom_core") { sources = [ - "messaging/message_port.mojom", + "messaging/cloneable_message.mojom", + "messaging/transferable_message.mojom", "messaging/user_activation_snapshot.mojom", "portal/portal.mojom", "service_worker/service_worker.mojom",
diff --git a/third_party/blink/public/mojom/messaging/cloneable_message.mojom b/third_party/blink/public/mojom/messaging/cloneable_message.mojom new file mode 100644 index 0000000..19f1da0 --- /dev/null +++ b/third_party/blink/public/mojom/messaging/cloneable_message.mojom
@@ -0,0 +1,27 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module blink.mojom; + +import "mojo/public/mojom/base/big_buffer.mojom"; +import "mojo/public/mojom/base/unguessable_token.mojom"; +import "third_party/blink/public/mojom/blob/serialized_blob.mojom"; + +// This struct represents the cloneable part of messages that are sent across +// postMessage style APIs. In particular this is used for BroadcastChannel. +struct CloneableMessage { + mojo_base.mojom.BigBuffer encoded_message; + // Blob handles for any blobs being sent in this message. + array<SerializedBlob> blobs; + // Stack trace captured by sender. + // For more details see v8_inspector::V8StackTraceId. + // TODO(kozyatinskiy): move this to separate headers as soon as we get + // separate inspector folder. + uint64 stack_trace_id; + int64 stack_trace_debugger_id_first; + int64 stack_trace_debugger_id_second; + // If not null, this message is locked to the given agent cluster ID. + // See https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-agent-cluster-formalism + mojo_base.mojom.UnguessableToken? locked_agent_cluster_id; +};
diff --git a/third_party/blink/public/mojom/messaging/message_port.mojom b/third_party/blink/public/mojom/messaging/message_port.mojom deleted file mode 100644 index f030eab..0000000 --- a/third_party/blink/public/mojom/messaging/message_port.mojom +++ /dev/null
@@ -1,55 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -module blink.mojom; - -import "mojo/public/mojom/base/big_buffer.mojom"; -import "mojo/public/mojom/base/unguessable_token.mojom"; -import "third_party/blink/public/mojom/array_buffer/array_buffer_contents.mojom"; -import "third_party/blink/public/mojom/blob/serialized_blob.mojom"; -import "third_party/blink/public/mojom/messaging/user_activation_snapshot.mojom"; -import "skia/public/interfaces/bitmap.mojom"; - -// A MessagePort is represented as a raw mojo message pipe, as such no interface -// definition exists for it here. Messages on this pipe are serialized versions -// of the TransferableMessage struct defined below. -// TODO(crbug.com/750468): Consider using an actual Mojo interface for message -// ports. - -// This struct represents the cloneable part of messages that are sent across -// postMessage style APIs. In particular this is used for BroadcastChannel. -struct CloneableMessage { - mojo_base.mojom.BigBuffer encoded_message; - // Blob handles for any blobs being sent in this message. - array<SerializedBlob> blobs; - // Stack trace captured by sender. - // For more details see v8_inspector::V8StackTraceId. - // TODO(kozyatinskiy): move this to separate headers as soon as we get - // separate inspector folder. - uint64 stack_trace_id; - int64 stack_trace_debugger_id_first; - int64 stack_trace_debugger_id_second; - // If not null, this message is locked to the given agent cluster ID. - // See https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-agent-cluster-formalism - mojo_base.mojom.UnguessableToken? locked_agent_cluster_id; -}; - -// This struct combines the cloneable part of a message with the parts of the -// message that are merely transferable. In particular that includes ports that -// are transfered. This struct is used for most postMessage style APIs, -// including messages posted on MessagePorts themselves. -struct TransferableMessage { - CloneableMessage message; - // Any ports being transfered as part of this message. - array<handle<message_pipe>> ports; - // Any ArrayBuffers being transfered as part of this message. - array<SerializedArrayBufferContents> array_buffer_contents_array; - // Any ImageBitmaps being transfered as part of this message. - array<skia.mojom.Bitmap> image_bitmap_contents_array; - // Whether the recipient should have a user gesture when it processes this - // message. - bool has_user_gesture; - // The user activation state, null if the frame isn't providing it. - UserActivationSnapshot? user_activation; -};
diff --git a/third_party/blink/public/mojom/messaging/transferable_message.mojom b/third_party/blink/public/mojom/messaging/transferable_message.mojom new file mode 100644 index 0000000..f660019 --- /dev/null +++ b/third_party/blink/public/mojom/messaging/transferable_message.mojom
@@ -0,0 +1,36 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module blink.mojom; + +import "third_party/blink/public/mojom/array_buffer/array_buffer_contents.mojom"; +import "third_party/blink/public/mojom/blob/serialized_blob.mojom"; +import "third_party/blink/public/mojom/messaging/cloneable_message.mojom"; +import "third_party/blink/public/mojom/messaging/user_activation_snapshot.mojom"; +import "skia/public/interfaces/bitmap.mojom"; + +// A MessagePort is represented as a raw mojo message pipe, as such no interface +// definition exists for it here. Messages on this pipe are serialized versions +// of the TransferableMessage struct defined below. +// TODO(crbug.com/750468): Consider using an actual Mojo interface for message +// ports. + +// This struct combines the cloneable part of a message with the parts of the +// message that are merely transferable. In particular that includes ports that +// are transferred. This struct is used for most postMessage style APIs, +// including messages posted on MessagePorts themselves. +struct TransferableMessage { + CloneableMessage message; + // Any ports being transferred as part of this message. + array<handle<message_pipe>> ports; + // Any ArrayBuffers being transferred as part of this message. + array<SerializedArrayBufferContents> array_buffer_contents_array; + // Any ImageBitmaps being transferred as part of this message. + array<skia.mojom.Bitmap> image_bitmap_contents_array; + // Whether the recipient should have a user gesture when it processes this + // message. + bool has_user_gesture; + // The user activation state, null if the frame isn't providing it. + UserActivationSnapshot? user_activation; +};
diff --git a/third_party/blink/public/mojom/service_worker/service_worker.mojom b/third_party/blink/public/mojom/service_worker/service_worker.mojom index 096cb24..31951624 100644 --- a/third_party/blink/public/mojom/service_worker/service_worker.mojom +++ b/third_party/blink/public/mojom/service_worker/service_worker.mojom
@@ -4,7 +4,7 @@ module blink.mojom; -import "third_party/blink/public/mojom/messaging/message_port.mojom"; +import "third_party/blink/public/mojom/messaging/transferable_message.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_error_type.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_client.mojom"; import "url/mojom/url.mojom";
diff --git a/third_party/blink/public/mojom/service_worker/service_worker_object.mojom b/third_party/blink/public/mojom/service_worker/service_worker_object.mojom index 2645595..7d2e193 100644 --- a/third_party/blink/public/mojom/service_worker/service_worker_object.mojom +++ b/third_party/blink/public/mojom/service_worker/service_worker_object.mojom
@@ -4,7 +4,7 @@ module blink.mojom; -import "third_party/blink/public/mojom/messaging/message_port.mojom"; +import "third_party/blink/public/mojom/messaging/transferable_message.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_state.mojom"; import "url/mojom/url.mojom";
diff --git a/third_party/blink/public/platform/modules/broadcastchannel/broadcast_channel.mojom b/third_party/blink/public/platform/modules/broadcastchannel/broadcast_channel.mojom index b37834d3..740aa500 100644 --- a/third_party/blink/public/platform/modules/broadcastchannel/broadcast_channel.mojom +++ b/third_party/blink/public/platform/modules/broadcastchannel/broadcast_channel.mojom
@@ -4,7 +4,7 @@ module blink.mojom; -import "third_party/blink/public/mojom/messaging/message_port.mojom"; +import "third_party/blink/public/mojom/messaging/cloneable_message.mojom"; import "url/mojom/origin.mojom"; // A pair of BroadcastChannelClient interfaces is used to represent a connection
diff --git a/third_party/blink/public/platform/modules/service_worker/web_service_worker_clients_info.h b/third_party/blink/public/platform/modules/service_worker/web_service_worker_clients_info.h index ffb6f985..b005aaf 100644 --- a/third_party/blink/public/platform/modules/service_worker/web_service_worker_clients_info.h +++ b/third_party/blink/public/platform/modules/service_worker/web_service_worker_clients_info.h
@@ -11,7 +11,6 @@ #include "third_party/blink/public/platform/web_callbacks.h" #include "third_party/blink/public/platform/web_url.h" #include "third_party/blink/public/platform/web_url_request.h" -#include "third_party/blink/public/platform/web_vector.h" #include <memory> @@ -35,17 +34,9 @@ mojom::ServiceWorkerClientType client_type; }; -struct WebServiceWorkerClientsInfo { - WebVector<WebServiceWorkerClientInfo> clients; -}; - -// Two WebCallbacks, one for one client, one for a WebVector of clients. using WebServiceWorkerClientCallbacks = WebCallbacks<std::unique_ptr<WebServiceWorkerClientInfo>, const WebServiceWorkerError&>; -using WebServiceWorkerClientsCallbacks = - WebCallbacks<const WebServiceWorkerClientsInfo&, - const WebServiceWorkerError&>; } // namespace blink
diff --git a/third_party/blink/public/platform/modules/service_worker/web_service_worker_skip_waiting_callbacks.h b/third_party/blink/public/platform/modules/service_worker/web_service_worker_skip_waiting_callbacks.h deleted file mode 100644 index dbd894d..0000000 --- a/third_party/blink/public/platform/modules/service_worker/web_service_worker_skip_waiting_callbacks.h +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_SKIP_WAITING_CALLBACKS_H_ -#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_SKIP_WAITING_CALLBACKS_H_ - -#include "third_party/blink/public/platform/web_callbacks.h" - -namespace blink { - -using WebServiceWorkerSkipWaitingCallbacks = WebCallbacks<void, void>; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_SKIP_WAITING_CALLBACKS_H_
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h index a293758..4128909 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h
@@ -133,6 +133,10 @@ class WebURLResponse; struct WebSize; +namespace scheduler { +class WebThreadScheduler; +} + class BLINK_PLATFORM_EXPORT Platform { public: // HTML5 Database ------------------------------------------------------ @@ -144,8 +148,10 @@ #endif // Initialize platform and wtf. If you need to initialize the entire Blink, - // you should use blink::Initialize. - static void Initialize(Platform*, WebThread* main_thread); + // you should use blink::Initialize. WebThreadScheduler must be owned by + // the embedder. + static void Initialize(Platform*, + scheduler::WebThreadScheduler* main_thread_scheduler); static Platform* Current(); // This is another entry point for embedders that only require simple @@ -155,20 +161,23 @@ // embedders do not need to override CurrentThread(), if your application // is single-threaded. If your application supports multi-thread, you // need to override CurrentThread() as well as CreateThread(). - // - // When this function is used, the WebThread instance for the main thread - // is owned by Platform (unlike Initialize()). - // - // In the future, we would like to let Platform own the WebThread object for - // the main thread in all cases, as part of Blink Thread Initialization - // Cleanup project: - // https://docs.google.com/document/d/1ehd6Lp5czBzOCHWrDkL9x62gjdlrtbMtJqt_eRaauYo/edit?usp=sharing static void CreateMainThreadAndInitialize(Platform*); // Used to switch the current platform only for testing. // You should not pass in a Platform object that is not fully instantiated. static void SetCurrentPlatformForTesting(Platform*); + // These are dirty workaround for tests requiring the main thread task runner + // from a non-main thread. If your test needs base::ScopedTaskEnvironment + // and a non-main thread may call MainThread()->GetTaskRunner(), call + // SetMainThreadTaskRunnerForTesting() in your test fixture's SetUp(), and + // call UnsetMainThreadTaskRunnerForTesting() in TearDown(). + // + // TODO(yutak): Ideally, these should be packed in a custom test fixture + // along with ScopedTaskEnvironment for reusability. + static void SetMainThreadTaskRunnerForTesting(); + static void UnsetMainThreadTaskRunnerForTesting(); + Platform(); virtual ~Platform(); @@ -427,12 +436,11 @@ // for any other purpose. virtual std::unique_ptr<WebThread> CreateWebAudioThread(); - // Returns an interface to the current thread. This is usually owned by the - // embedder, except when CreateMainThreadAndInitialize() is used. See comments - // above for details. + // Returns an interface to the current thread. // - // The default implementation works only if CreateMainThreadAndInitialize() is - // used. Otherwise, the embedder *must* implement their own version. + // The default implementation only works on the main thread. If your + // application supports multi-thread, you *must* override this function + // as well as CreateThread(). virtual WebThread* CurrentThread(); // Returns a blame context for attributing top-level work which does not @@ -745,12 +753,12 @@ private: static void InitializeCommon(Platform* platform); - // We eventually want to let Platform own the main thread WebThread, but - // currently the main thread is owned in a few selected cases. This variable - // is non-null when the main thread is owned by Platform. The pointer value - // is the same as main_thread_. + // Platform owns the main thread in most cases. The pointer value is the same + // as main_thread_ if this variable is non-null. // - // For details, see comments around CreateMainThreadAndInitialize() above. + // This variable is null if (and only if) ScopedTestingPlatformSupport<> + // overrides the old Platform. In this case, main_thread_ points to the old + // Platform's main thread. See testing_platform_support.h for this. std::unique_ptr<WebThread> owned_main_thread_; };
diff --git a/third_party/blink/public/platform/web_thread.h b/third_party/blink/public/platform/web_thread.h index 4460437..d7b39bc 100644 --- a/third_party/blink/public/platform/web_thread.h +++ b/third_party/blink/public/platform/web_thread.h
@@ -45,6 +45,7 @@ class FrameOrWorkerScheduler; class ThreadScheduler; +class Platform; // Always an integer value. typedef uintptr_t PlatformThreadId; @@ -70,6 +71,8 @@ // run. class BLINK_PLATFORM_EXPORT WebThread { public: + friend class Platform; // For IsSimpleMainThread(). + // An IdleTask is expected to complete before the deadline it is passed. using IdleTask = base::OnceCallback<void(base::TimeTicks deadline)>; @@ -114,6 +117,11 @@ virtual ThreadScheduler* Scheduler() const = 0; virtual ~WebThread() = default; + + private: + // This is used to identify the actual WebThread instance. This should be + // used only in Platform, and other users should ignore this. + virtual bool IsSimpleMainThread() const { return false; } }; } // namespace blink
diff --git a/third_party/blink/public/web/blink.h b/third_party/blink/public/web/blink.h index 322a311..d255161 100644 --- a/third_party/blink/public/web/blink.h +++ b/third_party/blink/public/web/blink.h
@@ -38,14 +38,15 @@ namespace blink { // Initialize the entire Blink (wtf, platform, core, modules and web). -// If you just need wtf and platform, use Platform::initialize instead. +// If you just need wtf and platform, use Platform::Initialize instead. // // Must be called on the thread that will be the main thread before -// using any other public APIs. The provided Platform; must be -// non-null and must remain valid until the current thread calls shutdown. -BLINK_EXPORT void Initialize(Platform*, - service_manager::BinderRegistry*, - WebThread* main_thread); +// using any other public APIs. The provided Platform must be non-null and +// must remain valid until the current thread calls shutdown. +BLINK_EXPORT void Initialize( + Platform*, + service_manager::BinderRegistry*, + scheduler::WebThreadScheduler* main_thread_scheduler); // The same as above, but this only supports simple single-threaded execution // environment. The main thread WebThread object is owned by Platform when this
diff --git a/third_party/blink/public/web/web_remote_frame.h b/third_party/blink/public/web/web_remote_frame.h index 2addfb254..2d506698 100644 --- a/third_party/blink/public/web/web_remote_frame.h +++ b/third_party/blink/public/web/web_remote_frame.h
@@ -66,7 +66,9 @@ WebFrame* opener) = 0; // Layer for the in-process compositor. - virtual void SetCcLayer(cc::Layer*, bool prevent_contents_opaque_changes) = 0; + virtual void SetCcLayer(cc::Layer*, + bool prevent_contents_opaque_changes, + bool is_surface_layer) = 0; // Set security origin replicated from another process. virtual void SetReplicatedOrigin( @@ -138,8 +140,6 @@ virtual WebRect GetCompositingRect() = 0; - virtual bool OOPIFHasPointerEventsNone() const = 0; - protected: explicit WebRemoteFrame(WebTreeScopeType scope) : WebFrame(scope) {}
diff --git a/third_party/blink/public/web/web_remote_frame_client.h b/third_party/blink/public/web/web_remote_frame_client.h index d57c8e7..de85c47 100644 --- a/third_party/blink/public/web/web_remote_frame_client.h +++ b/third_party/blink/public/web/web_remote_frame_client.h
@@ -56,9 +56,6 @@ // Set inherited effective touch action on the remote frame. virtual void SetInheritedEffectiveTouchAction(blink::WebTouchAction) {} - // Update pointer-events property on the remote frame. - virtual void PointerEventsChanged() {} - // Toggles render throttling for the remote frame. virtual void UpdateRenderThrottlingStatus(bool is_throttled, bool subtree_throttled) {}
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/post_message_helper.h b/third_party/blink/renderer/bindings/core/v8/serialization/post_message_helper.h index b426b8957..2c9a498b 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/post_message_helper.h +++ b/third_party/blink/renderer/bindings/core/v8/serialization/post_message_helper.h
@@ -6,7 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_SERIALIZATION_POST_MESSAGE_HELPER_H_ #include "base/memory/scoped_refptr.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom-blink.h" +#include "third_party/blink/public/mojom/messaging/user_activation_snapshot.mojom-blink.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "v8/include/v8.h"
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_event_listener_impl.cc b/third_party/blink/renderer/bindings/core/v8/v8_event_listener_impl.cc index 118c8a9d..4316f37 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_event_listener_impl.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_event_listener_impl.cc
@@ -21,7 +21,8 @@ ScriptState* script_state, const V8PrivateProperty::Symbol& property) : EventListener(kJSEventListenerType), - event_listener_(V8EventListener::Create(listener)) { + event_listener_(V8EventListener::CreateOrNull(listener)) { + DCHECK(event_listener_); Attach(script_state, listener, property, this); if (IsMainThread()) { InstanceCounters::IncrementCounter(
diff --git a/third_party/blink/renderer/bindings/templates/callback_interface.cpp.tmpl b/third_party/blink/renderer/bindings/templates/callback_interface.cpp.tmpl index bc03e5e..f68d464 100644 --- a/third_party/blink/renderer/bindings/templates/callback_interface.cpp.tmpl +++ b/third_party/blink/renderer/bindings/templates/callback_interface.cpp.tmpl
@@ -55,6 +55,7 @@ {{install_constants() | trim | indent(2)}} } +// static v8::Local<v8::FunctionTemplate> {{v8_class}}::DomTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) { return V8DOMConfiguration::DomClassTemplate( isolate, @@ -68,6 +69,19 @@ return "{{v8_class}}"; } +// static +{{v8_class}}* {{v8_class}}::CreateOrNull(v8::Local<v8::Object> callback_object) { + v8::Local<v8::Context> creation_context = callback_object->CreationContext(); + // When |callback_object| is an object in RemoteContext (i.e. RemoteInstance), + // the object has no creation context, and no way to proceed. + // TODO(crbug.com/886588): Make CreateOrNull into Create removing the early + // return with nullptr. + if (creation_context.IsEmpty()) + return nullptr; + + return new {{v8_class}}(callback_object, creation_context); +} + {% for method in methods %} v8::Maybe<{{method.cpp_type}}> {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}}) {
diff --git a/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl b/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl index 8db43d46..fdc35365 100644 --- a/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl +++ b/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl
@@ -27,9 +27,11 @@ {% endfor %} {% endif %} - static {{v8_class}}* Create(v8::Local<v8::Object> callback_object) { - return new {{v8_class}}(callback_object); - } + // Creates and returns a new instance. Returns nullptr when |callback_object| + // is an object in a remote context (e.g. cross origin window object). The + // call sites may want to throw a SecurityError in the case. + // See also crbug.com/886588 + static {{v8_class}}* CreateOrNull(v8::Local<v8::Object> callback_object); ~{{v8_class}}() override = default; @@ -53,8 +55,11 @@ {% set single_operation_enum_value = 'kSingleOperation' if is_single_operation_callback_interface else 'kNotSingleOperation' %} - explicit {{v8_class}}(v8::Local<v8::Object> callback_object) - : CallbackInterfaceBase(callback_object, {{single_operation_enum_value}}) {} + explicit {{v8_class}}( + v8::Local<v8::Object> callback_object, + v8::Local<v8::Context> callback_object_creation_context) + : CallbackInterfaceBase(callback_object, callback_object_creation_context, + {{single_operation_enum_value}}) {} }; template <>
diff --git a/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl b/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl index b005f2f..4ede69f 100644 --- a/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl +++ b/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl
@@ -152,7 +152,16 @@ {% if argument.is_callback_interface %} {# FIXME: remove EventListener special case. crbug.com/630986 #} {% if argument.idl_type == 'EventListener' %} -if (!IsUndefinedOrNull(info[{{argument.index}}]) && !info[{{argument.index}}]->IsObject()) { +if (info[{{argument.index}}]->IsNullOrUndefined()) { + // Just go through. +} else if (info[{{argument.index}}]->IsObject()) { + // TODO(crbug.com/886588): Remove the following special casing. + if (info[{{argument.index}}].As<v8::Object>()->CreationContext().IsEmpty()) { + {{define_exception_state}} + exceptionState.ThrowSecurityError("The callback provided as parameter {{argument.index + 1}} is a cross origin object."); + return; + } +} else { {{throw_argument_error(method, argument, "The callback provided as parameter %(index)d is not an object.")}} return; } @@ -163,7 +172,12 @@ {% endif %}{# method.name #} {% else %}{# argument.idl_type == 'EventListener' #} if (info[{{argument.index}}]->IsObject()) { - {{argument.name}} = V8{{argument.idl_type}}::Create(info[{{argument.index}}].As<v8::Object>()); + {{argument.name}} = V8{{argument.idl_type}}::CreateOrNull(info[{{argument.index}}].As<v8::Object>()); + if (!{{argument.name}}) { + {{define_exception_state}} + exceptionState.ThrowSecurityError("The callback provided as parameter {{argument.index + 1}} is a cross origin object."); + return; + } {% if argument.is_nullable %} } else if (info[{{argument.index}}]->IsNullOrUndefined()) { {{argument.name}} = nullptr;
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.cc index 16854a6..e078d5d 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.cc
@@ -25,6 +25,19 @@ return "V8TestCallbackInterface"; } +// static +V8TestCallbackInterface* V8TestCallbackInterface::CreateOrNull(v8::Local<v8::Object> callback_object) { + v8::Local<v8::Context> creation_context = callback_object->CreationContext(); + // When |callback_object| is an object in RemoteContext (i.e. RemoteInstance), + // the object has no creation context, and no way to proceed. + // TODO(crbug.com/886588): Make CreateOrNull into Create removing the early + // return with nullptr. + if (creation_context.IsEmpty()) + return nullptr; + + return new V8TestCallbackInterface(callback_object, creation_context); +} + v8::Maybe<void> V8TestCallbackInterface::voidMethod(ScriptWrappable* callback_this_value) { if (!IsCallbackFunctionRunnable(CallbackRelevantScriptState(), IncumbentScriptState())) {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.h b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.h index c7388b1..68f3f2b 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.h
@@ -21,9 +21,11 @@ class CORE_EXPORT V8TestCallbackInterface final : public CallbackInterfaceBase { public: - static V8TestCallbackInterface* Create(v8::Local<v8::Object> callback_object) { - return new V8TestCallbackInterface(callback_object); - } + // Creates and returns a new instance. Returns nullptr when |callback_object| + // is an object in a remote context (e.g. cross origin window object). The + // call sites may want to throw a SecurityError in the case. + // See also crbug.com/886588 + static V8TestCallbackInterface* CreateOrNull(v8::Local<v8::Object> callback_object); ~V8TestCallbackInterface() override = default; @@ -67,8 +69,11 @@ v8::Maybe<void> customVoidMethodTestInterfaceEmptyArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) WARN_UNUSED_RESULT; private: - explicit V8TestCallbackInterface(v8::Local<v8::Object> callback_object) - : CallbackInterfaceBase(callback_object, kNotSingleOperation) {} + explicit V8TestCallbackInterface( + v8::Local<v8::Object> callback_object, + v8::Local<v8::Context> callback_object_creation_context) + : CallbackInterfaceBase(callback_object, callback_object_creation_context, + kNotSingleOperation) {} }; template <>
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.cc index 599bcd8..eb3b1c43 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.cc
@@ -69,6 +69,7 @@ static_assert(42 == TestLegacyCallbackInterface::kConstValueUshort42, "the value of TestLegacyCallbackInterface_kConstValueUshort42 does not match with implementation"); } +// static v8::Local<v8::FunctionTemplate> V8TestLegacyCallbackInterface::DomTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) { return V8DOMConfiguration::DomClassTemplate( isolate, @@ -81,6 +82,19 @@ return "V8TestLegacyCallbackInterface"; } +// static +V8TestLegacyCallbackInterface* V8TestLegacyCallbackInterface::CreateOrNull(v8::Local<v8::Object> callback_object) { + v8::Local<v8::Context> creation_context = callback_object->CreationContext(); + // When |callback_object| is an object in RemoteContext (i.e. RemoteInstance), + // the object has no creation context, and no way to proceed. + // TODO(crbug.com/886588): Make CreateOrNull into Create removing the early + // return with nullptr. + if (creation_context.IsEmpty()) + return nullptr; + + return new V8TestLegacyCallbackInterface(callback_object, creation_context); +} + v8::Maybe<uint16_t> V8TestLegacyCallbackInterface::acceptNode(ScriptWrappable* callback_this_value, Node* node) { if (!IsCallbackFunctionRunnable(CallbackRelevantScriptState(), IncumbentScriptState())) {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.h b/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.h index afe5edc..3adabef 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.h
@@ -29,9 +29,11 @@ // Constants static constexpr uint16_t CONST_VALUE_USHORT_42 = 42; - static V8TestLegacyCallbackInterface* Create(v8::Local<v8::Object> callback_object) { - return new V8TestLegacyCallbackInterface(callback_object); - } + // Creates and returns a new instance. Returns nullptr when |callback_object| + // is an object in a remote context (e.g. cross origin window object). The + // call sites may want to throw a SecurityError in the case. + // See also crbug.com/886588 + static V8TestLegacyCallbackInterface* CreateOrNull(v8::Local<v8::Object> callback_object); ~V8TestLegacyCallbackInterface() override = default; @@ -43,8 +45,11 @@ v8::Maybe<uint16_t> acceptNode(ScriptWrappable* callback_this_value, Node* node) WARN_UNUSED_RESULT; private: - explicit V8TestLegacyCallbackInterface(v8::Local<v8::Object> callback_object) - : CallbackInterfaceBase(callback_object, kSingleOperation) {} + explicit V8TestLegacyCallbackInterface( + v8::Local<v8::Object> callback_object, + v8::Local<v8::Context> callback_object_creation_context) + : CallbackInterfaceBase(callback_object, callback_object_creation_context, + kSingleOperation) {} }; template <>
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc index 371e7c6..7281e7a 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc
@@ -5438,6 +5438,8 @@ } static void voidMethodTestCallbackInterfaceArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "voidMethodTestCallbackInterfaceArg"); + TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { @@ -5447,7 +5449,11 @@ V8TestCallbackInterface* testCallbackInterfaceArg; if (info[0]->IsObject()) { - testCallbackInterfaceArg = V8TestCallbackInterface::Create(info[0].As<v8::Object>()); + testCallbackInterfaceArg = V8TestCallbackInterface::CreateOrNull(info[0].As<v8::Object>()); + if (!testCallbackInterfaceArg) { + exceptionState.ThrowSecurityError("The callback provided as parameter 1 is a cross origin object."); + return; + } } else { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute("voidMethodTestCallbackInterfaceArg", "TestObject", "The callback provided as parameter 1 is not an object.")); return; @@ -5457,11 +5463,17 @@ } static void voidMethodOptionalTestCallbackInterfaceArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "voidMethodOptionalTestCallbackInterfaceArg"); + TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8TestCallbackInterface* optionalTestCallbackInterfaceArg; if (info[0]->IsObject()) { - optionalTestCallbackInterfaceArg = V8TestCallbackInterface::Create(info[0].As<v8::Object>()); + optionalTestCallbackInterfaceArg = V8TestCallbackInterface::CreateOrNull(info[0].As<v8::Object>()); + if (!optionalTestCallbackInterfaceArg) { + exceptionState.ThrowSecurityError("The callback provided as parameter 1 is a cross origin object."); + return; + } } else if (info[0]->IsUndefined()) { optionalTestCallbackInterfaceArg = nullptr; } else { @@ -5473,6 +5485,8 @@ } static void voidMethodTestCallbackInterfaceOrNullArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "voidMethodTestCallbackInterfaceOrNullArg"); + TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { @@ -5482,7 +5496,11 @@ V8TestCallbackInterface* testCallbackInterfaceArg; if (info[0]->IsObject()) { - testCallbackInterfaceArg = V8TestCallbackInterface::Create(info[0].As<v8::Object>()); + testCallbackInterfaceArg = V8TestCallbackInterface::CreateOrNull(info[0].As<v8::Object>()); + if (!testCallbackInterfaceArg) { + exceptionState.ThrowSecurityError("The callback provided as parameter 1 is a cross origin object."); + return; + } } else if (info[0]->IsNullOrUndefined()) { testCallbackInterfaceArg = nullptr; } else { @@ -5734,6 +5752,8 @@ } static void voidMethodNodeFilterArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "voidMethodNodeFilterArg"); + TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { @@ -5743,7 +5763,11 @@ V8NodeFilter* nodeFilterArg; if (info[0]->IsObject()) { - nodeFilterArg = V8NodeFilter::Create(info[0].As<v8::Object>()); + nodeFilterArg = V8NodeFilter::CreateOrNull(info[0].As<v8::Object>()); + if (!nodeFilterArg) { + exceptionState.ThrowSecurityError("The callback provided as parameter 1 is a cross origin object."); + return; + } } else { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute("voidMethodNodeFilterArg", "TestObject", "The callback provided as parameter 1 is not an object.")); return; @@ -7268,11 +7292,17 @@ } static void overloadedMethodN2Method(const v8::FunctionCallbackInfo<v8::Value>& info) { + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "overloadedMethodN"); + TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8TestCallbackInterface* testCallbackInterfaceArg; if (info[0]->IsObject()) { - testCallbackInterfaceArg = V8TestCallbackInterface::Create(info[0].As<v8::Object>()); + testCallbackInterfaceArg = V8TestCallbackInterface::CreateOrNull(info[0].As<v8::Object>()); + if (!testCallbackInterfaceArg) { + exceptionState.ThrowSecurityError("The callback provided as parameter 1 is a cross origin object."); + return; + } } else { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute("overloadedMethodN", "TestObject", "The callback provided as parameter 1 is not an object.")); return; @@ -8484,7 +8514,11 @@ V8TestCallbackInterface* testCallbackInterfaceArg; if (info[0]->IsObject()) { - testCallbackInterfaceArg = V8TestCallbackInterface::Create(info[0].As<v8::Object>()); + testCallbackInterfaceArg = V8TestCallbackInterface::CreateOrNull(info[0].As<v8::Object>()); + if (!testCallbackInterfaceArg) { + exceptionState.ThrowSecurityError("The callback provided as parameter 1 is a cross origin object."); + return; + } } else { exceptionState.ThrowTypeError("The callback provided as parameter 1 is not an object."); return; @@ -8503,7 +8537,11 @@ V8TestCallbackInterface* optionalTestCallbackInterfaceArg; if (info[0]->IsObject()) { - optionalTestCallbackInterfaceArg = V8TestCallbackInterface::Create(info[0].As<v8::Object>()); + optionalTestCallbackInterfaceArg = V8TestCallbackInterface::CreateOrNull(info[0].As<v8::Object>()); + if (!optionalTestCallbackInterfaceArg) { + exceptionState.ThrowSecurityError("The callback provided as parameter 1 is a cross origin object."); + return; + } } else if (info[0]->IsUndefined()) { optionalTestCallbackInterfaceArg = nullptr; } else {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_typedefs.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_typedefs.cc index c45a4c6bb..d5a59bd 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_typedefs.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_typedefs.cc
@@ -208,6 +208,8 @@ } static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kExecutionContext, "TestTypedefs", "voidMethodTestCallbackInterfaceTypeArg"); + TestTypedefs* impl = V8TestTypedefs::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { @@ -217,7 +219,11 @@ V8TestCallbackInterface* testCallbackInterfaceTypeArg; if (info[0]->IsObject()) { - testCallbackInterfaceTypeArg = V8TestCallbackInterface::Create(info[0].As<v8::Object>()); + testCallbackInterfaceTypeArg = V8TestCallbackInterface::CreateOrNull(info[0].As<v8::Object>()); + if (!testCallbackInterfaceTypeArg) { + exceptionState.ThrowSecurityError("The callback provided as parameter 1 is a cross origin object."); + return; + } } else { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute("voidMethodTestCallbackInterfaceTypeArg", "TestTypedefs", "The callback provided as parameter 1 is not an object.")); return;
diff --git a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl index fd32fbc..2751ccf 100644 --- a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl +++ b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl
@@ -38,13 +38,13 @@ return RuntimeEnabledFeatures::{{property.runtime_flag}}Enabled(); } {% endif %} - const char* GetPropertyName() const override { return "{{property.name}}\0"; } + const char* GetPropertyName() const override { return "{{property.name}}"; } const WTF::AtomicString& GetPropertyNameAtomicString() const override { - static const WTF::AtomicString& name = WTF::AtomicString("{{property.name}}\0"); + DEFINE_STATIC_LOCAL(const AtomicString, name, ("{{property.name}}")); return name; } const WTF::String GetJSPropertyName() const override { - return WTF::String("{{property_classname[0].lower() + property_classname[1:]}}\0"); + return WTF::String("{{property_classname[0].lower() + property_classname[1:]}}"); } {% if property.alias_for == None %} CSSPropertyID PropertyID() const override { return {{property.property_id}}; }
diff --git a/third_party/blink/renderer/controller/blink_initializer.cc b/third_party/blink/renderer/controller/blink_initializer.cc index 27ad5077..c3b92b5 100644 --- a/third_party/blink/renderer/controller/blink_initializer.cc +++ b/third_party/blink/renderer/controller/blink_initializer.cc
@@ -140,9 +140,9 @@ void Initialize(Platform* platform, service_manager::BinderRegistry* registry, - WebThread* main_thread) { + scheduler::WebThreadScheduler* main_thread_scheduler) { DCHECK(registry); - Platform::Initialize(platform, main_thread); + Platform::Initialize(platform, main_thread_scheduler); InitializeCommon(platform, registry); }
diff --git a/third_party/blink/renderer/core/DEPS b/third_party/blink/renderer/core/DEPS index 03e5d763..64bb7a2 100644 --- a/third_party/blink/renderer/core/DEPS +++ b/third_party/blink/renderer/core/DEPS
@@ -24,6 +24,7 @@ "+cc/layers/layer_sticky_position_constraint.h", "+cc/layers/picture_layer.h", "+cc/layers/scrollbar_layer_interface.h", + "+cc/layers/surface_layer.h", "+cc/paint/display_item_list.h", "+cc/paint/paint_canvas.h", "+cc/paint/paint_flags.h",
diff --git a/third_party/blink/renderer/core/animation/css/css_animations.cc b/third_party/blink/renderer/core/animation/css/css_animations.cc index a8b1553..e96eb0f 100644 --- a/third_party/blink/renderer/core/animation/css/css_animations.cc +++ b/third_party/blink/renderer/core/animation/css/css_animations.cc
@@ -135,17 +135,10 @@ } } - DEFINE_STATIC_LOCAL(SparseHistogram, property_histogram, - ("WebCore.Animation.CSSProperties")); for (const CSSProperty* property : specified_properties_for_use_counter) { DCHECK(isValidCSSPropertyID(property->PropertyID())); UseCounter::CountAnimatedCSS(element_for_scoping->GetDocument(), property->PropertyID()); - - // TODO(crbug.com/458925): Remove legacy histogram and counts - property_histogram.Sample( - UseCounter::MapCSSPropertyIdToCSSSampleIdForHistogram( - property->PropertyID())); } // Merge duplicate keyframes. @@ -613,13 +606,6 @@ DCHECK(isValidCSSPropertyID(property.GetCSSProperty().PropertyID())); UseCounter::CountAnimatedCSS(element->GetDocument(), property.GetCSSProperty().PropertyID()); - - // TODO(crbug.com/458925): Remove legacy histogram and counts - DEFINE_STATIC_LOCAL(SparseHistogram, property_histogram, - ("WebCore.Animation.CSSProperties")); - property_histogram.Sample( - UseCounter::MapCSSPropertyIdToCSSSampleIdForHistogram( - property.GetCSSProperty().PropertyID())); } ClearPendingUpdate(); }
diff --git a/third_party/blink/renderer/core/animation/scroll_timeline.cc b/third_party/blink/renderer/core/animation/scroll_timeline.cc index c4b62ae1..ca0e67b0 100644 --- a/third_party/blink/renderer/core/animation/scroll_timeline.cc +++ b/third_party/blink/renderer/core/animation/scroll_timeline.cc
@@ -4,6 +4,8 @@ #include "third_party/blink/renderer/core/animation/scroll_timeline.h" +#include "third_party/blink/renderer/core/css/parser/css_tokenizer.h" +#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" #include "third_party/blink/renderer/core/layout/layout_box.h" #include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h" @@ -40,6 +42,19 @@ } return false; } + +bool StringToScrollOffset(String scroll_offset, CSSPrimitiveValue** result) { + CSSTokenizer tokenizer(scroll_offset); + const auto tokens = tokenizer.TokenizeToEOF(); + CSSParserTokenRange range(tokens); + CSSValue* value = CSSParsingUtils::ConsumeScrollOffset(range); + if (!value) + return false; + + // We support 'auto', but for simplicity just store it as nullptr. + *result = value->IsIdentifierValue() ? nullptr : ToCSSPrimitiveValue(value); + return true; +} } // namespace ScrollTimeline* ScrollTimeline::Create(Document& document, @@ -55,6 +70,19 @@ return nullptr; } + CSSPrimitiveValue* start_scroll_offset = nullptr; + if (!StringToScrollOffset(options.startScrollOffset(), + &start_scroll_offset)) { + exception_state.ThrowTypeError("Invalid startScrollOffset"); + return nullptr; + } + + CSSPrimitiveValue* end_scroll_offset = nullptr; + if (!StringToScrollOffset(options.endScrollOffset(), &end_scroll_offset)) { + exception_state.ThrowTypeError("Invalid endScrollOffset"); + return nullptr; + } + // TODO(smcgruer): Support 'auto' value. if (options.timeRange().IsScrollTimelineAutoKeyword()) { exception_state.ThrowDOMException( @@ -63,15 +91,20 @@ return nullptr; } - return new ScrollTimeline(scroll_source, orientation, + return new ScrollTimeline(scroll_source, orientation, start_scroll_offset, + end_scroll_offset, options.timeRange().GetAsDouble()); } ScrollTimeline::ScrollTimeline(Element* scroll_source, ScrollDirection orientation, + CSSPrimitiveValue* start_scroll_offset, + CSSPrimitiveValue* end_scroll_offset, double time_range) : scroll_source_(scroll_source), orientation_(orientation), + start_scroll_offset_(start_scroll_offset), + end_scroll_offset_(end_scroll_offset), time_range_(time_range) { DCHECK(scroll_source_); } @@ -163,6 +196,14 @@ } } +String ScrollTimeline::startScrollOffset() { + return start_scroll_offset_ ? start_scroll_offset_->CssText() : "auto"; +} + +String ScrollTimeline::endScrollOffset() { + return end_scroll_offset_ ? end_scroll_offset_->CssText() : "auto"; +} + void ScrollTimeline::timeRange(DoubleOrScrollTimelineAutoKeyword& result) { result.SetDouble(time_range_); } @@ -211,6 +252,8 @@ void ScrollTimeline::Trace(blink::Visitor* visitor) { visitor->Trace(scroll_source_); + visitor->Trace(start_scroll_offset_); + visitor->Trace(end_scroll_offset_); AnimationTimeline::Trace(visitor); }
diff --git a/third_party/blink/renderer/core/animation/scroll_timeline.h b/third_party/blink/renderer/core/animation/scroll_timeline.h index dba7810..397c25f 100644 --- a/third_party/blink/renderer/core/animation/scroll_timeline.h +++ b/third_party/blink/renderer/core/animation/scroll_timeline.h
@@ -8,6 +8,7 @@ #include "third_party/blink/renderer/core/animation/animation_timeline.h" #include "third_party/blink/renderer/core/animation/scroll_timeline_options.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -45,6 +46,8 @@ // IDL API implementation. Element* scrollSource(); String orientation(); + String startScrollOffset(); + String endScrollOffset(); void timeRange(DoubleOrScrollTimelineAutoKeyword&); // Returns the Node that should actually have the ScrollableArea (if one @@ -69,10 +72,16 @@ static bool HasActiveScrollTimeline(Node* node); private: - ScrollTimeline(Element*, ScrollDirection, double); + ScrollTimeline(Element*, + ScrollDirection, + CSSPrimitiveValue*, + CSSPrimitiveValue*, + double); Member<Element> scroll_source_; ScrollDirection orientation_; + Member<CSSPrimitiveValue> start_scroll_offset_; + Member<CSSPrimitiveValue> end_scroll_offset_; double time_range_; };
diff --git a/third_party/blink/renderer/core/animation/scroll_timeline.idl b/third_party/blink/renderer/core/animation/scroll_timeline.idl index 06e991a..fb29483 100644 --- a/third_party/blink/renderer/core/animation/scroll_timeline.idl +++ b/third_party/blink/renderer/core/animation/scroll_timeline.idl
@@ -13,5 +13,7 @@ ] interface ScrollTimeline : AnimationTimeline { readonly attribute Element? scrollSource; readonly attribute ScrollDirection orientation; + readonly attribute DOMString startScrollOffset; + readonly attribute DOMString endScrollOffset; readonly attribute (double or ScrollTimelineAutoKeyword) timeRange; };
diff --git a/third_party/blink/renderer/core/animation/scroll_timeline_options.idl b/third_party/blink/renderer/core/animation/scroll_timeline_options.idl index ebc4a74..0f518d2 100644 --- a/third_party/blink/renderer/core/animation/scroll_timeline_options.idl +++ b/third_party/blink/renderer/core/animation/scroll_timeline_options.idl
@@ -16,5 +16,7 @@ dictionary ScrollTimelineOptions { Element scrollSource; ScrollDirection orientation = "block"; + DOMString startScrollOffset = "auto"; + DOMString endScrollOffset = "auto"; (double or ScrollTimelineAutoKeyword) timeRange = "auto"; };
diff --git a/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc b/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc index deb3c17..c2dd683c 100644 --- a/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc +++ b/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc
@@ -438,6 +438,17 @@ return IsContentPositionKeyword(id) || IsLeftOrRightKeyword(id); } +CSSValue* ConsumeScrollOffset(CSSParserTokenRange& range) { + range.ConsumeWhitespace(); + if (CSSPropertyParserHelpers::IdentMatches<CSSValueAuto>(range.Peek().Id())) + return CSSPropertyParserHelpers::ConsumeIdent(range); + CSSValue* value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + range, kHTMLStandardMode, kValueRangeNonNegative); + if (!range.AtEnd()) + return nullptr; + return value; +} + CSSValue* ConsumeSelfPositionOverflowPosition( CSSParserTokenRange& range, IsPositionKeyword is_position_keyword) {
diff --git a/third_party/blink/renderer/core/css/properties/css_parsing_utils.h b/third_party/blink/renderer/core/css/properties/css_parsing_utils.h index 130ab18..44358b05 100644 --- a/third_party/blink/renderer/core/css/properties/css_parsing_utils.h +++ b/third_party/blink/renderer/core/css/properties/css_parsing_utils.h
@@ -45,6 +45,7 @@ bool IsContentPositionKeyword(CSSValueID); bool IsContentPositionOrLeftOrRightKeyword(CSSValueID); +CSSValue* ConsumeScrollOffset(CSSParserTokenRange&); CSSValue* ConsumeSelfPositionOverflowPosition(CSSParserTokenRange&, IsPositionKeyword); CSSValue* ConsumeSimplifiedDefaultPosition(CSSParserTokenRange&,
diff --git a/third_party/blink/renderer/core/css/properties/longhands/variable.h b/third_party/blink/renderer/core/css/properties/longhands/variable.h index e10d823..6faf1e6 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/variable.h +++ b/third_party/blink/renderer/core/css/properties/longhands/variable.h
@@ -20,9 +20,9 @@ bool IsInherited() const override { return true; } bool IsAffectedByAll() const override { return false; } CSSPropertyID PropertyID() const override { return CSSPropertyVariable; } - const char* GetPropertyName() const override { return "variable\0"; } + const char* GetPropertyName() const override { return "variable"; } const WTF::AtomicString& GetPropertyNameAtomicString() const override { - static const WTF::AtomicString& name = WTF::AtomicString("variable\0"); + DEFINE_STATIC_LOCAL(const AtomicString, name, ("variable")); return name; } const CSSValue* CSSValueFromComputedStyleInternal(
diff --git a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc index 0c7bc45..fec361a0 100644 --- a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc +++ b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc
@@ -307,7 +307,14 @@ } if (IsHTMLLegendElement(element) && style.Display() != EDisplay::kContents) { - style.SetDisplay(EDisplay::kBlock); + // Allow any blockified display value for legends. Note that according to + // the spec, this shouldn't affect computed style (like we do here). + // Instead, the display override should be determined during box creation, + // and even then only be applied to the rendered legend inside a + // fieldset. However, Blink determines the rendered legend during layout + // instead of during layout object creation, and also generally makes + // assumptions that the computed display value is the one to use. + style.SetDisplay(EquivalentBlockDisplay(style.Display())); return; }
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index f8e2b53..38dcbf0 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -2238,8 +2238,8 @@ // style), schedule another mouseMove event to check if any other elements // ended up under the mouse pointer due to re-layout. if (HoverElement() && !HoverElement()->GetLayoutObject() && GetFrame()) { - GetFrame()->GetEventHandler().DispatchFakeMouseMoveEventSoon( - MouseEventManager::FakeMouseMoveReason::kPerFrame); + GetFrame()->GetEventHandler().MayUpdateHoverWhenContentUnderMouseChanged( + MouseEventManager::UpdateHoverReason::kLayoutOrStyleChanged); } if (focused_element_ && !focused_element_->IsFocusable()) @@ -4736,7 +4736,7 @@ goto SetFocusedElementDone; } CancelFocusAppearanceUpdate(); - UpdateStyleAndLayoutIgnorePendingStylesheetsForNode(focused_element_); + EnsurePaintLocationDataValidForNode(focused_element_); // UpdateStyleAndLayout can call SetFocusedElement (through // ScrollAndFocusFragmentAnchor called in Document::LayoutUpdated) and clear // focused_element_.
diff --git a/third_party/blink/renderer/core/editing/ephemeral_range.h b/third_party/blink/renderer/core/editing/ephemeral_range.h index d51b650..9eec436 100644 --- a/third_party/blink/renderer/core/editing/ephemeral_range.h +++ b/third_party/blink/renderer/core/editing/ephemeral_range.h
@@ -107,7 +107,7 @@ Node* CommonAncestorContainer() const; - // Returns true if |m_startPositoin| == |m_endPosition| or |isNull()|. + // Returns true if |m_startPosition| == |m_endPosition| or |isNull()|. bool IsCollapsed() const; bool IsNull() const { DCHECK(IsValid());
diff --git a/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc b/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc index cfad8dd..95ff0936 100644 --- a/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc +++ b/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc
@@ -48,6 +48,8 @@ #include "third_party/blink/renderer/core/editing/markers/suggestion_marker_list_impl.h" #include "third_party/blink/renderer/core/editing/markers/text_match_marker.h" #include "third_party/blink/renderer/core/editing/markers/text_match_marker_list_impl.h" +#include "third_party/blink/renderer/core/editing/position.h" +#include "third_party/blink/renderer/core/editing/visible_position.h" #include "third_party/blink/renderer/core/editing/visible_units.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/layout/layout_object.h" @@ -387,6 +389,78 @@ InvalidatePaintForNode(node); } +DocumentMarker* DocumentMarkerController::FirstMarkerAroundPosition( + const Position& position, + DocumentMarker::MarkerTypes types) { + if (position.IsNull()) + return {}; + + Position start_of_word = + StartOfWord(CreateVisiblePosition(position), kPreviousWordIfOnBoundary) + .DeepEquivalent(); + if (start_of_word.IsNull()) + start_of_word = position; + Position end_of_word = + EndOfWord(CreateVisiblePosition(position), kNextWordIfOnBoundary) + .DeepEquivalent(); + if (end_of_word.IsNull()) + end_of_word = position; + + DCHECK_LE(start_of_word, end_of_word) + << "|Start_of_word| should be before |end_of_word|"; + + const Node* const start_node = start_of_word.ComputeContainerNode(); + const unsigned start_offset = start_of_word.ComputeOffsetInContainerNode(); + const Node* const end_node = end_of_word.ComputeContainerNode(); + const unsigned end_offset = end_of_word.ComputeOffsetInContainerNode(); + + for (const Node& node : EphemeralRange(start_of_word, end_of_word).Nodes()) { + if (!node.IsTextNode()) + continue; + + const unsigned start_range_offset = node == start_node ? start_offset : 0; + const unsigned end_range_offset = + node == end_node ? end_offset : ToText(node).length(); + + DocumentMarker* const found_marker = FirstMarkerIntersectingOffsetRange( + ToText(node), start_range_offset, end_range_offset, types); + if (found_marker) + return found_marker; + } + + return {}; +} + +DocumentMarker* DocumentMarkerController::FirstMarkerIntersectingEphemeralRange( + const EphemeralRange& range, + DocumentMarker::MarkerTypes types) { + if (range.IsNull()) + return {}; + + if (range.IsCollapsed()) + return FirstMarkerAroundPosition(range.StartPosition(), types); + + const Node* const start_container = + range.StartPosition().ComputeContainerNode(); + const Node* const end_container = range.EndPosition().ComputeContainerNode(); + + // We don't currently support the case where a marker spans multiple nodes. + // See crbug.com/720065 + if (start_container != end_container) + return {}; + + if (!start_container->IsTextNode()) + return {}; + + const unsigned start_offset = + range.StartPosition().ComputeOffsetInContainerNode(); + const unsigned end_offset = + range.EndPosition().ComputeOffsetInContainerNode(); + + return FirstMarkerIntersectingOffsetRange(ToText(*start_container), + start_offset, end_offset, types); +} + DocumentMarker* DocumentMarkerController::FirstMarkerIntersectingOffsetRange( const Text& node, unsigned start_offset,
diff --git a/third_party/blink/renderer/core/editing/markers/document_marker_controller.h b/third_party/blink/renderer/core/editing/markers/document_marker_controller.h index 5d709d6..1e59ee4 100644 --- a/third_party/blink/renderer/core/editing/markers/document_marker_controller.h +++ b/third_party/blink/renderer/core/editing/markers/document_marker_controller.h
@@ -29,9 +29,12 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_DOCUMENT_MARKER_CONTROLLER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_DOCUMENT_MARKER_CONTROLLER_H_ +#include <utility> + #include "base/macros.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/synchronous_mutation_observer.h" +#include "third_party/blink/renderer/core/editing/forward.h" #include "third_party/blink/renderer/core/editing/iterators/text_iterator.h" #include "third_party/blink/renderer/core/editing/markers/composition_marker.h" #include "third_party/blink/renderer/core/editing/markers/document_marker.h" @@ -98,6 +101,24 @@ // TODO(rlanday): can these methods for retrieving markers be consolidated // without hurting efficiency? + // If the given position is either at the boundary or inside a word, expands + // the position to the surrounding word and then looks for a marker having the + // specified type. If the position is neither at the boundary or inside a + // word, expands the position to cover the space between the end of the + // previous and the start of the next words. If such a marker exists, this + // method will return one of them (no guarantees are provided as to which + // one). Otherwise, this method will return null. + DocumentMarker* FirstMarkerAroundPosition(const Position&, + DocumentMarker::MarkerTypes); + // Looks for a marker in the specified EphemeralRange of the specified type + // whose interior has non-empty overlap with the bounds of the range. + // If the range is collapsed, it uses FirstMarkerAroundPosition to expand the + // range to the surrounding word. + // If such a marker exists, this method will return one of them (no guarantees + // are provided as to which one). Otherwise, this method will return null. + DocumentMarker* FirstMarkerIntersectingEphemeralRange( + const EphemeralRange&, + DocumentMarker::MarkerTypes); // Looks for a marker in the specified node of the specified type whose // interior has non-empty overlap with the range [start_offset, end_offset]. // If the range is collapsed, this looks for a marker containing the offset of
diff --git a/third_party/blink/renderer/core/editing/selection_controller.cc b/third_party/blink/renderer/core/editing/selection_controller.cc index e7e6162..113dfe34 100644 --- a/third_party/blink/renderer/core/editing/selection_controller.cc +++ b/third_party/blink/renderer/core/editing/selection_controller.cc
@@ -132,14 +132,8 @@ DocumentMarker* SpellCheckMarkerAtPosition( DocumentMarkerController& document_marker_controller, const Position& position) { - const Node* const node = position.ComputeContainerNode(); - if (!node->IsTextNode()) - return nullptr; - - const unsigned offset = position.ComputeOffsetInContainerNode(); - return document_marker_controller.FirstMarkerIntersectingOffsetRange( - *ToText(node), offset, offset, - DocumentMarker::MarkerTypes::Misspelling()); + return document_marker_controller.FirstMarkerAroundPosition( + position, DocumentMarker::MarkerTypes::Misspelling()); } } // namespace
diff --git a/third_party/blink/renderer/core/editing/spellcheck/spell_checker.cc b/third_party/blink/renderer/core/editing/spellcheck/spell_checker.cc index 9c6a319..592fac0 100644 --- a/third_party/blink/renderer/core/editing/spellcheck/spell_checker.cc +++ b/third_party/blink/renderer/core/editing/spellcheck/spell_checker.cc
@@ -433,32 +433,14 @@ // Caret and range selections always return valid normalized ranges. const EphemeralRange& selection_range = FirstEphemeralRangeOf(selection); - Node* const selection_start_container = - selection_range.StartPosition().ComputeContainerNode(); - Node* const selection_end_container = - selection_range.EndPosition().ComputeContainerNode(); - - // We don't currently support the case where a misspelling spans multiple - // nodes. See crbug.com/720065 - if (selection_start_container != selection_end_container) - return {}; - - if (!selection_start_container->IsTextNode()) - return {}; - - const unsigned selection_start_offset = - selection_range.StartPosition().ComputeOffsetInContainerNode(); - const unsigned selection_end_offset = - selection_range.EndPosition().ComputeOffsetInContainerNode(); - DocumentMarker* const marker = - GetFrame().GetDocument()->Markers().FirstMarkerIntersectingOffsetRange( - ToText(*selection_start_container), selection_start_offset, - selection_end_offset, DocumentMarker::MarkerTypes::Misspelling()); + GetFrame().GetDocument()->Markers().FirstMarkerIntersectingEphemeralRange( + selection_range, DocumentMarker::MarkerTypes::Misspelling()); if (!marker) return {}; - return std::make_pair(selection_start_container, ToSpellCheckMarker(marker)); + return std::make_pair(selection_range.StartPosition().ComputeContainerNode(), + ToSpellCheckMarker(marker)); } std::pair<String, String> SpellChecker::SelectMisspellingAsync() {
diff --git a/third_party/blink/renderer/core/editing/spellcheck/spell_checker_test.cc b/third_party/blink/renderer/core/editing/spellcheck/spell_checker_test.cc index 3489945..022ada6 100644 --- a/third_party/blink/renderer/core/editing/spellcheck/spell_checker_test.cc +++ b/third_party/blink/renderer/core/editing/spellcheck/spell_checker_test.cc
@@ -149,7 +149,10 @@ .GetFrame() ->GetSpellChecker() .GetSpellCheckMarkerUnderSelection(); - EXPECT_NE(nullptr, result.first); + EXPECT_EQ(text, result.first); + ASSERT_NE(nullptr, result.second); + EXPECT_EQ(0u, result.second->StartOffset()); + EXPECT_EQ(8u, result.second->EndOffset()); } TEST_F(SpellCheckerTest, GetSpellCheckMarkerUnderSelection_LastCharSelected) { @@ -173,7 +176,10 @@ .GetFrame() ->GetSpellChecker() .GetSpellCheckMarkerUnderSelection(); - EXPECT_NE(nullptr, result.first); + EXPECT_EQ(text, result.first); + ASSERT_NE(nullptr, result.second); + EXPECT_EQ(0u, result.second->StartOffset()); + EXPECT_EQ(8u, result.second->EndOffset()); } TEST_F(SpellCheckerTest, @@ -198,7 +204,10 @@ .GetFrame() ->GetSpellChecker() .GetSpellCheckMarkerUnderSelection(); - EXPECT_NE(nullptr, result.first); + EXPECT_EQ(text, result.first); + ASSERT_NE(nullptr, result.second); + EXPECT_EQ(0u, result.second->StartOffset()); + EXPECT_EQ(1u, result.second->EndOffset()); } TEST_F(SpellCheckerTest, @@ -223,7 +232,10 @@ .GetFrame() ->GetSpellChecker() .GetSpellCheckMarkerUnderSelection(); - EXPECT_EQ(nullptr, result.first); + EXPECT_EQ(text, result.first); + ASSERT_NE(nullptr, result.second); + EXPECT_EQ(0u, result.second->StartOffset()); + EXPECT_EQ(1u, result.second->EndOffset()); } TEST_F(SpellCheckerTest, @@ -248,7 +260,10 @@ .GetFrame() ->GetSpellChecker() .GetSpellCheckMarkerUnderSelection(); - EXPECT_EQ(nullptr, result.first); + EXPECT_EQ(text, result.first); + ASSERT_NE(nullptr, result.second); + EXPECT_EQ(0u, result.second->StartOffset()); + EXPECT_EQ(1u, result.second->EndOffset()); } TEST_F(SpellCheckerTest, @@ -273,7 +288,10 @@ .GetFrame() ->GetSpellChecker() .GetSpellCheckMarkerUnderSelection(); - EXPECT_EQ(nullptr, result.first); + EXPECT_EQ(text, result.first); + ASSERT_NE(nullptr, result.second); + EXPECT_EQ(0u, result.second->StartOffset()); + EXPECT_EQ(8u, result.second->EndOffset()); } TEST_F(SpellCheckerTest, @@ -298,7 +316,10 @@ .GetFrame() ->GetSpellChecker() .GetSpellCheckMarkerUnderSelection(); - EXPECT_EQ(nullptr, result.first); + EXPECT_EQ(text, result.first); + ASSERT_NE(nullptr, result.second); + EXPECT_EQ(0u, result.second->StartOffset()); + EXPECT_EQ(8u, result.second->EndOffset()); } TEST_F(SpellCheckerTest, GetSpellCheckMarkerUnderSelection_CaretMiddleOfWord) { @@ -322,7 +343,10 @@ .GetFrame() ->GetSpellChecker() .GetSpellCheckMarkerUnderSelection(); - EXPECT_NE(nullptr, result.first); + EXPECT_EQ(text, result.first); + ASSERT_NE(nullptr, result.second); + EXPECT_EQ(0u, result.second->StartOffset()); + EXPECT_EQ(8u, result.second->EndOffset()); } TEST_F(SpellCheckerTest,
diff --git a/third_party/blink/renderer/core/exported/web_remote_frame_impl.cc b/third_party/blink/renderer/core/exported/web_remote_frame_impl.cc index 12c90acb..ba91421 100644 --- a/third_party/blink/renderer/core/exported/web_remote_frame_impl.cc +++ b/third_party/blink/renderer/core/exported/web_remote_frame_impl.cc
@@ -185,11 +185,10 @@ } void WebRemoteFrameImpl::SetCcLayer(cc::Layer* layer, - bool prevent_contents_opaque_changes) { - if (!GetFrame()) - return; - - GetFrame()->SetCcLayer(layer, prevent_contents_opaque_changes); + bool prevent_contents_opaque_changes, + bool is_surface_layer) { + GetFrame()->SetCcLayer(layer, prevent_contents_opaque_changes, + is_surface_layer); } void WebRemoteFrameImpl::SetCoreFrame(RemoteFrame* frame) { @@ -314,11 +313,7 @@ } bool WebRemoteFrameImpl::IsIgnoredForHitTest() const { - HTMLFrameOwnerElement* owner = GetFrame()->DeprecatedLocalOwner(); - if (!owner || !owner->GetLayoutObject()) - return false; - return owner->GetLayoutObject()->Style()->PointerEvents() == - EPointerEvents::kNone; + return GetFrame()->IsIgnoredForHitTest(); } void WebRemoteFrameImpl::WillEnterFullscreen() { @@ -446,11 +441,6 @@ return GetFrame()->View()->GetCompositingRect(); } -bool WebRemoteFrameImpl::OOPIFHasPointerEventsNone() const { - DCHECK(GetFrame()->DeprecatedLocalOwner()); - return GetFrame()->DeprecatedLocalOwner()->HasPointerEventsNone(); -} - WebRemoteFrameImpl::WebRemoteFrameImpl(WebTreeScopeType scope, WebRemoteFrameClient* client) : WebRemoteFrame(scope),
diff --git a/third_party/blink/renderer/core/exported/web_remote_frame_impl.h b/third_party/blink/renderer/core/exported/web_remote_frame_impl.h index 7d5588b..2337e119 100644 --- a/third_party/blink/renderer/core/exported/web_remote_frame_impl.h +++ b/third_party/blink/renderer/core/exported/web_remote_frame_impl.h
@@ -60,7 +60,9 @@ const ParsedFeaturePolicy&, WebRemoteFrameClient*, WebFrame* opener) override; - void SetCcLayer(cc::Layer*, bool prevent_contents_opaque_changes) override; + void SetCcLayer(cc::Layer*, + bool prevent_contents_opaque_changes, + bool is_surface_layer) override; void SetReplicatedOrigin( const WebSecurityOrigin&, bool is_potentially_trustworthy_opaque_origin) override; @@ -91,7 +93,6 @@ void SetHasReceivedUserGestureBeforeNavigation(bool value) override; v8::Local<v8::Object> GlobalProxy() const override; WebRect GetCompositingRect() override; - bool OOPIFHasPointerEventsNone() const override; void InitializeCoreFrame(Page&, FrameOwner*, const AtomicString& name); RemoteFrame* GetFrame() const { return frame_.Get(); }
diff --git a/third_party/blink/renderer/core/fetch/response.cc b/third_party/blink/renderer/core/fetch/response.cc index 95ff7f3e..fde4997 100644 --- a/third_party/blink/renderer/core/fetch/response.cc +++ b/third_party/blink/renderer/core/fetch/response.cc
@@ -230,7 +230,7 @@ unsigned short status = init.status(); // "1. If |init|'s status member is not in the range 200 to 599, inclusive, - // throw a RangeError." + // throw a RangeError." if (status < 200 || 599 < status) { exception_state.ThrowRangeError( ExceptionMessages::IndexOutsideRange<unsigned>( @@ -246,17 +246,18 @@ return nullptr; } - // "3. Let |r| be a new Response object, associated with a new response, - // Headers object, and Body object." + // "3. Let |r| be a new Response object, associated with a new response. + // "4. Set |r|'s headers to a new Headers object whose list is + // |r|'s response's header list, and guard is "response" " Response* r = new Response(ExecutionContext::From(script_state)); - - // "4. Set |r|'s response's status to |init|'s status member." + // "5. Set |r|'s response's status to |init|'s status member." r->response_->SetStatus(init.status()); - // "5. Set |r|'s response's status message to |init|'s statusText member." + // "6. Set |r|'s response's status message to |init|'s statusText member." r->response_->SetStatusMessage(AtomicString(init.statusText())); - // "6. If |init|'s headers member is present, run these substeps:" + // "7. If |init|'s headers exists, then fill |r|’s headers with + // |init|'s headers" if (init.hasHeaders()) { // "1. Empty |r|'s response's header list." r->response_->HeaderList()->ClearList(); @@ -266,36 +267,56 @@ if (exception_state.HadException()) return nullptr; } - // "7. If body is given, run these substeps:" + // "8. If body is non-null, then:" if (body) { - // "1. If |init|'s status member is a null body status, throw a - // TypeError." - // "2. Let |stream| and |Content-Type| be the result of extracting - // body." - // "3. Set |r|'s response's body to |stream|." - // "4. If |Content-Type| is non-null and |r|'s response's header list - // contains no header named `Content-Type`, append `Content-Type`/ - // |Content-Type| to |r|'s response's header list." - // https://fetch.spec.whatwg.org/#concept-bodyinit-extract - // Step 3, Blob: - // "If object's type attribute is not the empty byte sequence, set - // Content-Type to its value." + // "1. If |init|'s status is a null body status, then throw a TypeError." if (IsNullBodyStatus(status)) { exception_state.ThrowTypeError( "Response with null body status cannot have body"); return nullptr; } + // "2. Let |Content-Type| be null." + // "3. Set |r|'s response's body and |Content-Type| + // to the result of extracting body." + // https://fetch.spec.whatwg.org/#concept-bodyinit-extract + // Step 5, Blob: + // "If object's type attribute is not the empty byte sequence, set + // Content-Type to its value." r->response_->ReplaceBodyStreamBuffer(body); + + // https://fetch.spec.whatwg.org/#concept-bodyinit-extract + // Step 5, ReadableStream: + // "If object is disturbed or locked, then throw a TypeError." + // If the BodyStreamBuffer was not constructed from a ReadableStream + // then IsStreamLocked and IsStreamDisturbed will always be false. + // So we don't have to check BodyStreamBuffer is a ReadableStream + // or not. + if (body->IsStreamLocked(exception_state).value_or(true) || + body->IsStreamDisturbed(exception_state).value_or(true)) { + if (!exception_state.HadException()) { + exception_state.ThrowTypeError( + "Response body object should not be disturbed or locked"); + } + return nullptr; + } + + // "4. If |Content-Type| is non-null and |r|'s response's header list + // contains no header named `Content-Type`, append `Content-Type`/ + // |Content-Type| to |r|'s response's header list." if (!content_type.IsEmpty() && !r->response_->HeaderList()->Has("Content-Type")) r->response_->HeaderList()->Append("Content-Type", content_type); } - // "8. Set |r|'s MIME type to the result of extracting a MIME type + // "9. Set |r|'s MIME type to the result of extracting a MIME type // from |r|'s response's header list." r->response_->SetMIMEType(r->response_->HeaderList()->ExtractMIMEType()); - // "9. Return |r|." + // "10. Set |r|'s response’s HTTPS state to current settings object's" + // HTTPS state." + // "11. Resolve |r|'s trailer promise with a new Headers object whose + // guard is "immutable"." + // "12. Return |r|." return r; }
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index aa2c59e..b51dea93 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -2028,8 +2028,8 @@ FontFaceSetDocument::DidLayout(*frame_->GetDocument()); // Fire a fake a mouse move event to update hover state and mouse cursor, and // send the right mouse out/over events. - frame_->GetEventHandler().DispatchFakeMouseMoveEventSoon( - MouseEventManager::FakeMouseMoveReason::kPerFrame); + frame_->GetEventHandler().MayUpdateHoverWhenContentUnderMouseChanged( + MouseEventManager::UpdateHoverReason::kLayoutOrStyleChanged); UpdateGeometriesIfNeeded();
diff --git a/third_party/blink/renderer/core/frame/remote_frame.cc b/third_party/blink/renderer/core/frame/remote_frame.cc index c1930eaf..bc54e83 100644 --- a/third_party/blink/renderer/core/frame/remote_frame.cc +++ b/third_party/blink/renderer/core/frame/remote_frame.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/core/frame/remote_frame.h" +#include "cc/layers/surface_layer.h" #include "third_party/blink/renderer/bindings/core/v8/window_proxy.h" #include "third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -103,7 +104,7 @@ // of all these objects. Break the cycle by notifying of detachment. ToRemoteDOMWindow(dom_window_)->FrameDetached(); if (cc_layer_) - SetCcLayer(nullptr, false); + SetCcLayer(nullptr, false, false); } bool RemoteFrame::PrepareForCommit() { @@ -183,23 +184,40 @@ return static_cast<RemoteFrameClient*>(Frame::Client()); } +void RemoteFrame::PointerEventsChanged() { + if (!cc_layer_ || !is_surface_layer_) + return; + + static_cast<cc::SurfaceLayer*>(cc_layer_)->SetHasPointerEventsNone( + IsIgnoredForHitTest()); +} + +bool RemoteFrame::IsIgnoredForHitTest() const { + HTMLFrameOwnerElement* owner = DeprecatedLocalOwner(); + if (!owner || !owner->GetLayoutObject()) + return false; + return owner->GetLayoutObject()->Style()->PointerEvents() == + EPointerEvents::kNone; +} + void RemoteFrame::SetCcLayer(cc::Layer* cc_layer, - bool prevent_contents_opaque_changes) { + bool prevent_contents_opaque_changes, + bool is_surface_layer) { + DCHECK(Owner()); + if (cc_layer_) GraphicsLayer::UnregisterContentsLayer(cc_layer_); cc_layer_ = cc_layer; prevent_contents_opaque_changes_ = prevent_contents_opaque_changes; - if (cc_layer_) + is_surface_layer_ = is_surface_layer; + if (cc_layer_) { GraphicsLayer::RegisterContentsLayer(cc_layer_); + PointerEventsChanged(); + } - DCHECK(Owner()); ToHTMLFrameOwnerElement(Owner())->SetNeedsCompositingUpdate(); } -void RemoteFrame::PointerEventsChanged() { - Client()->PointerEventsChanged(); -} - void RemoteFrame::AdvanceFocus(WebFocusType type, LocalFrame* source) { Client()->AdvanceFocus(type, source); }
diff --git a/third_party/blink/renderer/core/frame/remote_frame.h b/third_party/blink/renderer/core/frame/remote_frame.h index 77d28f0e..afc7119 100644 --- a/third_party/blink/renderer/core/frame/remote_frame.h +++ b/third_party/blink/renderer/core/frame/remote_frame.h
@@ -46,7 +46,9 @@ ScrollGranularity granularity, Frame* child) override; - void SetCcLayer(cc::Layer*, bool prevent_contents_opaque_changes); + void SetCcLayer(cc::Layer*, + bool prevent_contents_opaque_changes, + bool is_surface_layer); cc::Layer* GetCcLayer() const { return cc_layer_; } bool WebLayerHasFixedContentsOpaque() const { return prevent_contents_opaque_changes_; @@ -62,6 +64,7 @@ RemoteFrameClient* Client() const; void PointerEventsChanged(); + bool IsIgnoredForHitTest() const; private: RemoteFrame(RemoteFrameClient*, Page&, FrameOwner*); @@ -80,6 +83,7 @@ Member<RemoteSecurityContext> security_context_; cc::Layer* cc_layer_ = nullptr; bool prevent_contents_opaque_changes_ = false; + bool is_surface_layer_ = false; }; inline RemoteFrameView* RemoteFrame::View() const {
diff --git a/third_party/blink/renderer/core/frame/remote_frame_client.h b/third_party/blink/renderer/core/frame/remote_frame_client.h index 8fd0df16..faf6c60 100644 --- a/third_party/blink/renderer/core/frame/remote_frame_client.h +++ b/third_party/blink/renderer/core/frame/remote_frame_client.h
@@ -62,8 +62,6 @@ virtual void SetInheritedEffectiveTouchAction(TouchAction) = 0; - virtual void PointerEventsChanged() = 0; - virtual void UpdateRenderThrottlingStatus(bool isThrottled, bool subtreeThrottled) = 0;
diff --git a/third_party/blink/renderer/core/frame/remote_frame_client_impl.cc b/third_party/blink/renderer/core/frame/remote_frame_client_impl.cc index e6cee698..b60c1a4 100644 --- a/third_party/blink/renderer/core/frame/remote_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/remote_frame_client_impl.cc
@@ -176,10 +176,6 @@ web_frame_->Client()->SetInheritedEffectiveTouchAction(touch_action); } -void RemoteFrameClientImpl::PointerEventsChanged() { - web_frame_->Client()->PointerEventsChanged(); -} - void RemoteFrameClientImpl::UpdateRenderThrottlingStatus( bool is_throttled, bool subtree_throttled) {
diff --git a/third_party/blink/renderer/core/frame/remote_frame_client_impl.h b/third_party/blink/renderer/core/frame/remote_frame_client_impl.h index b4dee59..fa9ad8cb 100644 --- a/third_party/blink/renderer/core/frame/remote_frame_client_impl.h +++ b/third_party/blink/renderer/core/frame/remote_frame_client_impl.h
@@ -49,7 +49,6 @@ void VisibilityChanged(bool visible) override; void SetIsInert(bool) override; void SetInheritedEffectiveTouchAction(TouchAction) override; - void PointerEventsChanged() override; void UpdateRenderThrottlingStatus(bool is_throttled, bool subtree_throttled) override; uint32_t Print(const IntRect&, cc::PaintCanvas*) const override;
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.cc b/third_party/blink/renderer/core/frame/visual_viewport.cc index b4a46c97..4db3c89 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport.cc
@@ -487,8 +487,8 @@ if (!values_changed) return false; - MainFrame()->GetEventHandler().DispatchFakeMouseMoveEventSoon( - MouseEventManager::FakeMouseMoveReason::kDuringScroll); + MainFrame()->GetEventHandler().MayUpdateHoverWhenContentUnderMouseChanged( + MouseEventManager::UpdateHoverReason::kScrollOffsetChanged); probe::didChangeViewport(MainFrame()); MainFrame()->Loader().SaveScrollState();
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/html_frame_owner_element.cc index 3bee3a0..93c9b11 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -442,12 +442,6 @@ return true; } -bool HTMLFrameOwnerElement::HasPointerEventsNone() const { - return GetComputedStyle() - ? GetComputedStyle()->PointerEvents() == EPointerEvents::kNone - : false; -} - void HTMLFrameOwnerElement::CancelPendingLazyLoad() { if (!lazy_load_frame_observer_) return;
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.h b/third_party/blink/renderer/core/html/html_frame_owner_element.h index 87d8bec..d103f87 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.h +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.h
@@ -116,7 +116,6 @@ // For unit tests, manually trigger the UpdateContainerPolicy method. void UpdateContainerPolicyForTests() { UpdateContainerPolicy(); } - bool HasPointerEventsNone() const; // This function is to notify ChildFrameCompositor of pointer-events changes // of an OOPIF. void PointerEventsChanged();
diff --git a/third_party/blink/renderer/core/input/event_handler.cc b/third_party/blink/renderer/core/input/event_handler.cc index 855949df..4f695be4 100644 --- a/third_party/blink/renderer/core/input/event_handler.cc +++ b/third_party/blink/renderer/core/input/event_handler.cc
@@ -1851,6 +1851,9 @@ // Clear mouse press state to avoid initiating a drag while context menu is // up. mouse_event_manager_->ReleaseMousePress(); + if (last_scrollbar_under_mouse_) + last_scrollbar_under_mouse_->MouseUp(event); + LayoutPoint position_in_contents = v->ConvertFromRootFrame(FlooredIntPoint(event.PositionInRootFrame())); HitTestRequest request(HitTestRequest::kActive); @@ -1999,13 +2002,15 @@ return mouse_event_manager_->FakeMouseMovePending(); } -void EventHandler::DispatchFakeMouseMoveEventSoon( - MouseEventManager::FakeMouseMoveReason fake_mouse_move_reason) { - mouse_event_manager_->DispatchFakeMouseMoveEventSoon(fake_mouse_move_reason); +void EventHandler::MayUpdateHoverWhenContentUnderMouseChanged( + MouseEventManager::UpdateHoverReason update_hover_reason) { + mouse_event_manager_->MayUpdateHoverWhenContentUnderMouseChanged( + update_hover_reason); } -void EventHandler::DispatchFakeMouseMoveEventSoonInQuad(const FloatQuad& quad) { - mouse_event_manager_->DispatchFakeMouseMoveEventSoonInQuad(quad); +void EventHandler::MayUpdateHoverAfterScroll( + const FloatQuad& scroller_rect_in_frame) { + mouse_event_manager_->MayUpdateHoverAfterScroll(scroller_rect_in_frame); } void EventHandler::SetResizingFrameSet(HTMLFrameSetElement* frame_set) {
diff --git a/third_party/blink/renderer/core/input/event_handler.h b/third_party/blink/renderer/core/input/event_handler.h index ad22ac85..b56309e 100644 --- a/third_party/blink/renderer/core/input/event_handler.h +++ b/third_party/blink/renderer/core/input/event_handler.h
@@ -96,8 +96,9 @@ void StopAutoscroll(); - void DispatchFakeMouseMoveEventSoon(MouseEventManager::FakeMouseMoveReason); - void DispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); + void MayUpdateHoverWhenContentUnderMouseChanged( + MouseEventManager::UpdateHoverReason); + void MayUpdateHoverAfterScroll(const FloatQuad&); HitTestResult HitTestResultAtLocation( const HitTestLocation&,
diff --git a/third_party/blink/renderer/core/input/mouse_event_manager.cc b/third_party/blink/renderer/core/input/mouse_event_manager.cc index db5b1bfc..a158527 100644 --- a/third_party/blink/renderer/core/input/mouse_event_manager.cc +++ b/third_party/blink/renderer/core/input/mouse_event_manager.cc
@@ -68,7 +68,7 @@ // The amount of time to wait before sending a fake mouse event on style and // layout changes sets to 50Hz, same as common screen refresh rate. -constexpr TimeDelta kFakeMouseMoveIntervalPerFrame = +constexpr TimeDelta kFakeMouseMoveIntervalAfterLayoutChange = TimeDelta::FromMilliseconds(20); // TODO(crbug.com/653490): Read these values from the OS. @@ -609,10 +609,17 @@ is_mouse_position_unknown_ = true; } -void MouseEventManager::DispatchFakeMouseMoveEventSoon( - MouseEventManager::FakeMouseMoveReason fake_mouse_move_reason) { - if (fake_mouse_move_reason == - MouseEventManager::FakeMouseMoveReason::kDuringScroll && +void MouseEventManager::MayUpdateHoverWhenContentUnderMouseChanged( + MouseEventManager::UpdateHoverReason update_hover_reason) { + if (RuntimeEnabledFeatures::NoHoverAfterLayoutChangeEnabled() && + update_hover_reason == + MouseEventManager::UpdateHoverReason::kLayoutOrStyleChanged) { + frame_->GetEventHandler().ScheduleCursorUpdate(); + return; + } + + if (update_hover_reason == + MouseEventManager::UpdateHoverReason::kScrollOffsetChanged && mouse_pressed_) return; @@ -628,24 +635,25 @@ // Or dispatch a fake mouse move to update hover states when the layout // changes. TimeDelta interval = - fake_mouse_move_reason == - MouseEventManager::FakeMouseMoveReason::kDuringScroll + update_hover_reason == + MouseEventManager::UpdateHoverReason::kScrollOffsetChanged ? kFakeMouseMoveIntervalDuringScroll - : kFakeMouseMoveIntervalPerFrame; + : kFakeMouseMoveIntervalAfterLayoutChange; fake_mouse_move_event_timer_.StartOneShot(interval, FROM_HERE); } -void MouseEventManager::DispatchFakeMouseMoveEventSoonInQuad( - const FloatQuad& quad) { +void MouseEventManager::MayUpdateHoverAfterScroll( + const FloatQuad& scroller_rect_in_frame) { LocalFrameView* view = frame_->View(); if (!view) return; - if (!quad.ContainsPoint(view->ViewportToFrame(last_known_mouse_position_))) + if (!scroller_rect_in_frame.ContainsPoint( + view->ViewportToFrame(last_known_mouse_position_))) return; - DispatchFakeMouseMoveEventSoon( - MouseEventManager::FakeMouseMoveReason::kDuringScroll); + MayUpdateHoverWhenContentUnderMouseChanged( + MouseEventManager::UpdateHoverReason::kScrollOffsetChanged); } WebInputEventResult MouseEventManager::HandleMousePressEvent(
diff --git a/third_party/blink/renderer/core/input/mouse_event_manager.h b/third_party/blink/renderer/core/input/mouse_event_manager.h index 15e6aeb8..2f2d6028 100644 --- a/third_party/blink/renderer/core/input/mouse_event_manager.h +++ b/third_party/blink/renderer/core/input/mouse_event_manager.h
@@ -43,7 +43,7 @@ virtual ~MouseEventManager(); void Trace(blink::Visitor*) override; - enum FakeMouseMoveReason { kDuringScroll, kPerFrame }; + enum UpdateHoverReason { kScrollOffsetChanged, kLayoutOrStyleChanged }; WebInputEventResult DispatchMouseEvent(EventTarget*, const AtomicString&, @@ -89,8 +89,9 @@ void FakeMouseMoveEventTimerFired(TimerBase*); void CancelFakeMouseMoveEvent(); - void DispatchFakeMouseMoveEventSoon(MouseEventManager::FakeMouseMoveReason); - void DispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); + void MayUpdateHoverWhenContentUnderMouseChanged( + MouseEventManager::UpdateHoverReason); + void MayUpdateHoverAfterScroll(const FloatQuad&); void SetLastKnownMousePosition(const WebMouseEvent&); void SetLastMousePositionAsUnknown();
diff --git a/third_party/blink/renderer/core/inspector/console_message_storage.cc b/third_party/blink/renderer/core/inspector/console_message_storage.cc index a821a3d..8b0b1f8 100644 --- a/third_party/blink/renderer/core/inspector/console_message_storage.cc +++ b/third_party/blink/renderer/core/inspector/console_message_storage.cc
@@ -79,11 +79,11 @@ expired_count_ = 0; } -size_t ConsoleMessageStorage::size() const { +wtf_size_t ConsoleMessageStorage::size() const { return messages_.size(); } -ConsoleMessage* ConsoleMessageStorage::at(size_t index) const { +ConsoleMessage* ConsoleMessageStorage::at(wtf_size_t index) const { return messages_[index].Get(); }
diff --git a/third_party/blink/renderer/core/inspector/console_message_storage.h b/third_party/blink/renderer/core/inspector/console_message_storage.h index caa5679..fd528545 100644 --- a/third_party/blink/renderer/core/inspector/console_message_storage.h +++ b/third_party/blink/renderer/core/inspector/console_message_storage.h
@@ -22,8 +22,8 @@ void AddConsoleMessage(ExecutionContext*, ConsoleMessage*); void Clear(); - size_t size() const; - ConsoleMessage* at(size_t index) const; + wtf_size_t size() const; + ConsoleMessage* at(wtf_size_t index) const; int ExpiredCount() const; void Trace(blink::Visitor*);
diff --git a/third_party/blink/renderer/core/inspector/dom_patch_support.cc b/third_party/blink/renderer/core/inspector/dom_patch_support.cc index 7806f4d..dd0b3ab 100644 --- a/third_party/blink/renderer/core/inspector/dom_patch_support.cc +++ b/third_party/blink/renderer/core/inspector/dom_patch_support.cc
@@ -223,48 +223,48 @@ ResultMap new_map(new_list.size()); ResultMap old_map(old_list.size()); - for (size_t i = 0; i < old_map.size(); ++i) { + for (wtf_size_t i = 0; i < old_map.size(); ++i) { old_map[i].first = nullptr; old_map[i].second = 0; } - for (size_t i = 0; i < new_map.size(); ++i) { + for (wtf_size_t i = 0; i < new_map.size(); ++i) { new_map[i].first = nullptr; new_map[i].second = 0; } // Trim head and tail. - for (size_t i = 0; i < old_list.size() && i < new_list.size() && - old_list[i]->sha1_ == new_list[i]->sha1_; + for (wtf_size_t i = 0; i < old_list.size() && i < new_list.size() && + old_list[i]->sha1_ == new_list[i]->sha1_; ++i) { old_map[i].first = old_list[i].Get(); old_map[i].second = i; new_map[i].first = new_list[i].Get(); new_map[i].second = i; } - for (size_t i = 0; i < old_list.size() && i < new_list.size() && - old_list[old_list.size() - i - 1]->sha1_ == - new_list[new_list.size() - i - 1]->sha1_; + for (wtf_size_t i = 0; i < old_list.size() && i < new_list.size() && + old_list[old_list.size() - i - 1]->sha1_ == + new_list[new_list.size() - i - 1]->sha1_; ++i) { - size_t old_index = old_list.size() - i - 1; - size_t new_index = new_list.size() - i - 1; + wtf_size_t old_index = old_list.size() - i - 1; + wtf_size_t new_index = new_list.size() - i - 1; old_map[old_index].first = old_list[old_index].Get(); old_map[old_index].second = new_index; new_map[new_index].first = new_list[new_index].Get(); new_map[new_index].second = old_index; } - typedef HashMap<String, Vector<size_t>> DiffTable; + typedef HashMap<String, Vector<wtf_size_t>> DiffTable; DiffTable new_table; DiffTable old_table; - for (size_t i = 0; i < new_list.size(); ++i) { - new_table.insert(new_list[i]->sha1_, Vector<size_t>()) + for (wtf_size_t i = 0; i < new_list.size(); ++i) { + new_table.insert(new_list[i]->sha1_, Vector<wtf_size_t>()) .stored_value->value.push_back(i); } - for (size_t i = 0; i < old_list.size(); ++i) { - old_table.insert(old_list[i]->sha1_, Vector<size_t>()) + for (wtf_size_t i = 0; i < old_list.size(); ++i) { + old_table.insert(old_list[i]->sha1_, Vector<wtf_size_t>()) .stored_value->value.push_back(i); } @@ -282,11 +282,11 @@ std::make_pair(old_list[old_it->value[0]].Get(), new_it.value[0]); } - for (size_t i = 0; new_list.size() > 0 && i < new_list.size() - 1; ++i) { + for (wtf_size_t i = 0; new_list.size() > 0 && i < new_list.size() - 1; ++i) { if (!new_map[i].first || new_map[i + 1].first) continue; - size_t j = new_map[i].second + 1; + wtf_size_t j = new_map[i].second + 1; if (j < old_map.size() && !old_map[j].first && new_list[i + 1]->sha1_ == old_list[j]->sha1_) { new_map[i + 1] = std::make_pair(new_list[i + 1].Get(), j); @@ -294,11 +294,11 @@ } } - for (size_t i = new_list.size() - 1; new_list.size() > 0 && i > 0; --i) { + for (wtf_size_t i = new_list.size() - 1; new_list.size() > 0 && i > 0; --i) { if (!new_map[i].first || new_map[i - 1].first || new_map[i].second <= 0) continue; - size_t j = new_map[i].second - 1; + wtf_size_t j = new_map[i].second - 1; if (!old_map[j].first && new_list[i - 1]->sha1_ == old_list[j]->sha1_) { new_map[i - 1] = std::make_pair(new_list[i - 1].Get(), j); old_map[j] = std::make_pair(old_list[j].Get(), i - 1); @@ -323,10 +323,10 @@ // 1. First strip everything except for the nodes that retain. Collect pending // merges. HeapHashMap<Member<Digest>, Member<Digest>> merges; - HashSet<size_t, WTF::IntHash<size_t>, - WTF::UnsignedWithZeroKeyHashTraits<size_t>> + HashSet<wtf_size_t, WTF::IntHash<wtf_size_t>, + WTF::UnsignedWithZeroKeyHashTraits<wtf_size_t>> used_new_ordinals; - for (size_t i = 0; i < old_list.size(); ++i) { + for (wtf_size_t i = 0; i < old_list.size(); ++i) { if (old_map[i].first) { if (used_new_ordinals.insert(old_map[i].second).is_new_entry) continue; @@ -350,9 +350,10 @@ if (!unused_nodes_map_.Contains(old_list[i]->sha1_) && (!i || old_map[i - 1].first) && (i == old_map.size() - 1 || old_map[i + 1].first)) { - size_t anchor_candidate = i ? old_map[i - 1].second + 1 : 0; - size_t anchor_after = (i == old_map.size() - 1) ? anchor_candidate + 1 - : old_map[i + 1].second; + wtf_size_t anchor_candidate = i ? old_map[i - 1].second + 1 : 0; + wtf_size_t anchor_after = (i == old_map.size() - 1) + ? anchor_candidate + 1 + : old_map[i + 1].second; if (anchor_after - anchor_candidate == 1 && anchor_candidate < new_list.size()) merges.Set(new_list[anchor_candidate].Get(), old_list[i].Get()); @@ -367,13 +368,13 @@ } // Mark retained nodes as used, do not reuse node more than once. - HashSet<size_t, WTF::IntHash<size_t>, - WTF::UnsignedWithZeroKeyHashTraits<size_t>> + HashSet<wtf_size_t, WTF::IntHash<wtf_size_t>, + WTF::UnsignedWithZeroKeyHashTraits<wtf_size_t>> used_old_ordinals; - for (size_t i = 0; i < new_list.size(); ++i) { + for (wtf_size_t i = 0; i < new_list.size(); ++i) { if (!new_map[i].first) continue; - size_t old_ordinal = new_map[i].second; + wtf_size_t old_ordinal = new_map[i].second; if (used_old_ordinals.Contains(old_ordinal)) { // Do not map node more than once new_map[i].first = nullptr; @@ -386,7 +387,7 @@ // Mark <head> and <body> nodes for merge. if (old_head || old_body) { - for (size_t i = 0; i < new_list.size(); ++i) { + for (wtf_size_t i = 0; i < new_list.size(); ++i) { if (old_head && IsHTMLHeadElement(*new_list[i]->node_)) merges.Set(new_list[i].Get(), old_head); if (old_body && IsHTMLBodyElement(*new_list[i]->node_)) @@ -401,7 +402,7 @@ } // 3. Insert missing nodes. - for (size_t i = 0; i < new_map.size(); ++i) { + for (wtf_size_t i = 0; i < new_map.size(); ++i) { if (new_map[i].first || merges.Contains(new_list[i].Get())) continue; if (!InsertBeforeAndMarkAsUsed(parent_node, new_list[i].Get(), @@ -411,7 +412,7 @@ } // 4. Then put all nodes that retained into their slots (sort by new index). - for (size_t i = 0; i < old_map.size(); ++i) { + for (wtf_size_t i = 0; i < old_map.size(); ++i) { if (!old_map[i].first) continue; Node* node = old_map[i].first->node_; @@ -517,7 +518,7 @@ return true; } - for (size_t i = 0; i < old_digest->children_.size(); ++i) { + for (wtf_size_t i = 0; i < old_digest->children_.size(); ++i) { if (!RemoveChildAndMoveToNew(old_digest->children_[i].Get(), exception_state)) return false; @@ -531,7 +532,7 @@ while (!queue.IsEmpty()) { Digest* first = queue.TakeFirst(); unused_nodes_map_.erase(first->sha1_); - for (size_t i = 0; i < first->children_.size(); ++i) + for (wtf_size_t i = 0; i < first->children_.size(); ++i) queue.push_back(first->children_[i].Get()); } }
diff --git a/third_party/blink/renderer/core/inspector/dom_patch_support.h b/third_party/blink/renderer/core/inspector/dom_patch_support.h index 5f55243..4093b871 100644 --- a/third_party/blink/renderer/core/inspector/dom_patch_support.h +++ b/third_party/blink/renderer/core/inspector/dom_patch_support.h
@@ -66,7 +66,7 @@ HeapVector<Member<Digest>> children_; }; - typedef HeapVector<std::pair<Member<Digest>, size_t>> ResultMap; + typedef HeapVector<std::pair<Member<Digest>, wtf_size_t>> ResultMap; typedef HeapHashMap<String, Member<Digest>> UnusedNodesMap; bool InnerPatchNode(Digest* old_node, Digest* new_node, ExceptionState&);
diff --git a/third_party/blink/renderer/core/inspector/identifiers_factory.cc b/third_party/blink/renderer/core/inspector/identifiers_factory.cc index c414e4e..2bf77a1 100644 --- a/third_party/blink/renderer/core/inspector/identifiers_factory.cc +++ b/third_party/blink/renderer/core/inspector/identifiers_factory.cc
@@ -27,6 +27,7 @@ #include "base/atomic_sequence_num.h" #include "base/process/process_handle.h" +#include "third_party/blink/renderer/core/dom/dom_node_ids.h" #include "third_party/blink/renderer/core/dom/weak_identifier_map.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_client.h" @@ -94,7 +95,12 @@ } // static -String IdentifiersFactory::AddProcessIdPrefixTo(int id) { +int IdentifiersFactory::IntIdForNode(Node* node) { + return static_cast<int>(DOMNodeIds::IdForNode(node)); +} + +// static +String IdentifiersFactory::AddProcessIdPrefixTo(uint64_t id) { uint32_t process_id = base::GetUniqueIdForProcess(); StringBuilder builder; @@ -106,15 +112,4 @@ return builder.ToString(); } -// static -int IdentifiersFactory::RemoveProcessIdPrefixFrom(const String& id, bool* ok) { - size_t dot_index = id.find('.'); - - if (dot_index == kNotFound) { - *ok = false; - return 0; - } - return id.Substring(dot_index + 1).ToInt(ok); -} - } // namespace blink
diff --git a/third_party/blink/renderer/core/inspector/identifiers_factory.h b/third_party/blink/renderer/core/inspector/identifiers_factory.h index 735fac98..7a000af 100644 --- a/third_party/blink/renderer/core/inspector/identifiers_factory.h +++ b/third_party/blink/renderer/core/inspector/identifiers_factory.h
@@ -36,6 +36,7 @@ class DocumentLoader; class Frame; class LocalFrame; +class Node; class InspectedFrames; class CORE_EXPORT IdentifiersFactory { @@ -58,9 +59,10 @@ static String IdFromToken(const base::UnguessableToken&); + static int IntIdForNode(Node* node); + private: - static String AddProcessIdPrefixTo(int id); - static int RemoveProcessIdPrefixFrom(const String&, bool* ok); + static String AddProcessIdPrefixTo(uint64_t id); }; } // namespace blink
diff --git a/third_party/blink/renderer/core/inspector/inspector_animation_agent.cc b/third_party/blink/renderer/core/inspector/inspector_animation_agent.cc index daea299..a740f0a 100644 --- a/third_party/blink/renderer/core/inspector/inspector_animation_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_animation_agent.cc
@@ -23,9 +23,9 @@ #include "third_party/blink/renderer/core/css/css_rule_list.h" #include "third_party/blink/renderer/core/css/css_style_rule.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver.h" -#include "third_party/blink/renderer/core/dom/dom_node_ids.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/inspector/add_string_to_digestor.h" +#include "third_party/blink/renderer/core/inspector/identifiers_factory.h" #include "third_party/blink/renderer/core/inspector/inspected_frames.h" #include "third_party/blink/renderer/core/inspector/inspector_css_agent.h" #include "third_party/blink/renderer/core/inspector/inspector_style_sheet.h" @@ -113,8 +113,10 @@ .setFill(computed_timing.fill()) .setEasing(easing) .build(); - if (effect->target()) - animation_object->setBackendNodeId(DOMNodeIds::IdForNode(effect->target())); + if (effect->target()) { + animation_object->setBackendNodeId( + IdentifiersFactory::IntIdForNode(effect->target())); + } return animation_object; } @@ -142,7 +144,7 @@ std::unique_ptr<protocol::Array<protocol::Animation::KeyframeStyle>> keyframes = protocol::Array<protocol::Animation::KeyframeStyle>::create(); - for (size_t i = 0; i < model->GetFrames().size(); i++) { + for (wtf_size_t i = 0; i < model->GetFrames().size(); i++) { const Keyframe* keyframe = model->GetFrames().at(i); // Ignore CSS Transitions if (!keyframe->IsStringKeyframe())
diff --git a/third_party/blink/renderer/core/inspector/inspector_audits_agent.cc b/third_party/blink/renderer/core/inspector/inspector_audits_agent.cc index c2e74ec..ea1ce1399 100644 --- a/third_party/blink/renderer/core/inspector/inspector_audits_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_audits_agent.cc
@@ -40,8 +40,9 @@ SkImageInfo info = SkImageInfo::Make(bitmap.width(), bitmap.height(), kRGBA_8888_SkColorType, kUnpremul_SkAlphaType); - size_t row_bytes = info.minRowBytes(); - Vector<unsigned char> pixel_storage(info.computeByteSize(row_bytes)); + uint32_t row_bytes = static_cast<uint32_t>(info.minRowBytes()); + Vector<unsigned char> pixel_storage( + SafeCast<wtf_size_t>(info.computeByteSize(row_bytes))); SkPixmap pixmap(info, pixel_storage.data(), row_bytes); sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
diff --git a/third_party/blink/renderer/core/inspector/inspector_css_agent.cc b/third_party/blink/renderer/core/inspector/inspector_css_agent.cc index 8944fc46..15d96f74 100644 --- a/third_party/blink/renderer/core/inspector/inspector_css_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_css_agent.cc
@@ -287,7 +287,7 @@ colors.push_back(background_color); found_opaque_color = true; } else { - for (size_t i = 0; i < colors.size(); i++) + for (wtf_size_t i = 0; i < colors.size(); i++) colors[i] = colors[i].Blend(background_color); found_opaque_color = found_opaque_color || background_color.HasAlpha(); @@ -1051,8 +1051,8 @@ if (!style) return css_keyframes_rules; const CSSAnimationData* animation_data = style->Animations(); - for (size_t i = 0; animation_data && i < animation_data->NameList().size(); - ++i) { + for (wtf_size_t i = 0; + animation_data && i < animation_data->NameList().size(); ++i) { AtomicString animation_name(animation_data->NameList()[i]); if (animation_name == CSSAnimationData::InitialName()) continue; @@ -1392,18 +1392,18 @@ Response InspectorCSSAgent::MultipleStyleTextsActions( std::unique_ptr<protocol::Array<protocol::CSS::StyleDeclarationEdit>> edits, HeapVector<Member<StyleSheetAction>>* actions) { - int n = edits->length(); + size_t n = edits->length(); if (n == 0) return Response::Error("Edits should not be empty"); - for (int i = 0; i < n; ++i) { + for (size_t i = 0; i < n; ++i) { protocol::CSS::StyleDeclarationEdit* edit = edits->get(i); InspectorStyleSheetBase* inspector_style_sheet = nullptr; Response response = AssertStyleSheetForId(edit->getStyleSheetId(), inspector_style_sheet); if (!response.isSuccess()) { - return Response::Error( - String::Format("StyleSheet not found for edit #%d of %d", i + 1, n)); + return Response::Error(String::Format( + "StyleSheet not found for edit #%zu of %zu", i + 1, n)); } SourceRange range; @@ -1661,14 +1661,14 @@ protocol::Array<protocol::CSS::MediaQuery>::create(); MediaValues* media_values = MediaValues::CreateDynamicIfFrameExists(frame); bool has_media_query_items = false; - for (size_t i = 0; i < query_vector.size(); ++i) { + for (wtf_size_t i = 0; i < query_vector.size(); ++i) { MediaQuery& query = *query_vector.at(i); const ExpressionHeapVector& expressions = query.Expressions(); std::unique_ptr<protocol::Array<protocol::CSS::MediaQueryExpression>> expression_array = protocol::Array<protocol::CSS::MediaQueryExpression>::create(); bool has_expression_items = false; - for (size_t j = 0; j < expressions.size(); ++j) { + for (wtf_size_t j = 0; j < expressions.size(); ++j) { const MediaQueryExp& media_query_exp = expressions.at(j); MediaQueryExpValue exp_value = media_query_exp.ExpValue(); if (!exp_value.is_value) @@ -2025,7 +2025,7 @@ std::unique_ptr<protocol::Array<int>> matching_selectors = protocol::Array<int>::create(); const CSSSelectorList& selector_list = rule->GetStyleRule()->SelectorList(); - long index = 0; + wtf_size_t index = 0; PseudoId element_pseudo_id = matches_for_pseudo_id ? matches_for_pseudo_id : element->GetPseudoId(); for (const CSSSelector* selector = selector_list.First(); selector;
diff --git a/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc b/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc index f255519..cc3f8b4 100644 --- a/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc
@@ -1064,9 +1064,8 @@ if (exception_state.HadException() || !result) continue; - unsigned long size = result->snapshotLength(exception_state); - for (unsigned long i = 0; !exception_state.HadException() && i < size; - ++i) { + wtf_size_t size = result->snapshotLength(exception_state); + for (wtf_size_t i = 0; !exception_state.HadException() && i < size; ++i) { Node* node = result->snapshotItem(i, exception_state); if (exception_state.HadException()) break; @@ -1445,7 +1444,7 @@ std::unique_ptr<protocol::DOM::Node> value = protocol::DOM::Node::create() .setNodeId(id) - .setBackendNodeId(DOMNodeIds::IdForNode(node)) + .setBackendNodeId(IdentifiersFactory::IntIdForNode(node)) .setNodeType(static_cast<int>(node->getNodeType())) .setNodeName(node->nodeName()) .setLocalName(local_name) @@ -1654,7 +1653,7 @@ V0InsertionPoint* insertion_point) { std::unique_ptr<protocol::Array<protocol::DOM::BackendNode>> distributed_nodes = protocol::Array<protocol::DOM::BackendNode>::create(); - for (size_t i = 0; i < insertion_point->DistributedNodesSize(); ++i) { + for (wtf_size_t i = 0; i < insertion_point->DistributedNodesSize(); ++i) { Node* distributed_node = insertion_point->DistributedNodeAt(i); if (IsWhitespace(distributed_node)) continue; @@ -1663,7 +1662,8 @@ protocol::DOM::BackendNode::create() .setNodeType(distributed_node->getNodeType()) .setNodeName(distributed_node->nodeName()) - .setBackendNodeId(DOMNodeIds::IdForNode(distributed_node)) + .setBackendNodeId( + IdentifiersFactory::IntIdForNode(distributed_node)) .build(); distributed_nodes->addItem(std::move(backend_node)); } @@ -1687,7 +1687,7 @@ protocol::DOM::BackendNode::create() .setNodeType(node->getNodeType()) .setNodeName(node->nodeName()) - .setBackendNodeId(DOMNodeIds::IdForNode(node)) + .setBackendNodeId(IdentifiersFactory::IntIdForNode(node)) .build(); distributed_nodes->addItem(std::move(backend_node)); } @@ -1702,7 +1702,7 @@ protocol::DOM::BackendNode::create() .setNodeType(node->getNodeType()) .setNodeName(node->nodeName()) - .setBackendNodeId(DOMNodeIds::IdForNode(node)) + .setBackendNodeId(IdentifiersFactory::IntIdForNode(node)) .build(); distributed_nodes->addItem(std::move(backend_node)); } @@ -2116,10 +2116,10 @@ if (!path_tokens.size()) return nullptr; - for (size_t i = 0; i < path_tokens.size() - 1; i += 2) { + for (wtf_size_t i = 0; i < path_tokens.size() - 1; i += 2) { bool success = true; String& index_value = path_tokens[i]; - unsigned child_number = index_value.ToUInt(&success); + wtf_size_t child_number = index_value.ToUInt(&success); Node* child; if (!success) { child = ShadowRootForNode(node, index_value); @@ -2130,7 +2130,7 @@ child = InnerFirstChild(node); } String child_name = path_tokens[i + 1]; - for (size_t j = 0; child && j < child_number; ++j) + for (wtf_size_t j = 0; child && j < child_number; ++j) child = InnerNextSibling(child); if (!child || child->nodeName() != child_name) @@ -2179,7 +2179,7 @@ } private: - int node_id_; + DOMNodeId node_id_; }; Response InspectorDOMAgent::setInspectedNode(int node_id) {
diff --git a/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc b/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc index f758965..e4a214f7 100644 --- a/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc
@@ -101,12 +101,12 @@ // Nodes and their Listeners for the concerned event types (order is top to // bottom). Vector<AtomicString> event_types = target->EventTypes(); - for (size_t j = 0; j < event_types.size(); ++j) { + for (wtf_size_t j = 0; j < event_types.size(); ++j) { AtomicString& type = event_types[j]; EventListenerVector* listeners = target->GetEventListeners(type); if (!listeners) continue; - for (size_t k = 0; k < listeners->size(); ++k) { + for (wtf_size_t k = 0; k < listeners->size(); ++k) { EventListener* event_listener = listeners->at(k).Callback(); if (event_listener->IsNativeBased()) continue; @@ -126,7 +126,7 @@ if (handler.IsEmpty()) continue; bool use_capture = listeners->at(k).Capture(); - int backend_node_id = 0; + DOMNodeId backend_node_id = 0; if (target_node) { backend_node_id = DOMNodeIds::IdForNode(target_node); target_wrapper = NodeV8Value( @@ -151,7 +151,7 @@ static bool FilterNodesWithListeners(Node* node) { Vector<AtomicString> event_types = node->EventTypes(); - for (size_t j = 0; j < event_types.size(); ++j) { + for (wtf_size_t j = 0; j < event_types.size(); ++j) { EventListenerVector* listeners = node->GetEventListeners(event_types[j]); if (listeners && listeners->size()) return true; @@ -475,7 +475,7 @@ value->setOriginalHandler(v8_session_->wrapObject( context, info.handler, object_group_id, false /* generatePreview */)); if (info.backend_node_id) - value->setBackendNodeId(info.backend_node_id); + value->setBackendNodeId(static_cast<int>(info.backend_node_id)); } return value; }
diff --git a/third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.cc b/third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.cc index a54f97b..30d7c417 100644 --- a/third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.cc
@@ -36,7 +36,6 @@ #include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/core/layout/layout_text.h" #include "third_party/blink/renderer/core/layout/layout_view.h" -#include "third_party/blink/renderer/core/layout/line/inline_text_box.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/paint/paint_layer_stacking_node.h" @@ -82,8 +81,8 @@ } LayoutRect TextFragmentRectInDocument(const LayoutObject* layout_object, - const InlineTextBox* text_box) { - FloatRect local_coords_text_box_rect(text_box->FrameRect()); + const LayoutText::TextBoxInfo& text_box) { + FloatRect local_coords_text_box_rect(text_box.local_rect); LayoutRect absolute_coords_text_box_rect( layout_object->LocalToAbsoluteQuad(local_coords_text_box_rect) .BoundingBox()); @@ -132,7 +131,7 @@ : public WTF::GenericHashTraits<Vector<String>> { static unsigned GetHash(const Vector<String>& vec) { unsigned h = DefaultHash<size_t>::Hash::GetHash(vec.size()); - for (size_t i = 0; i < vec.size(); i++) { + for (wtf_size_t i = 0; i < vec.size(); i++) { h = WTF::HashInts(h, DefaultHash<String>::Hash::GetHash(vec[i])); } return h; @@ -141,7 +140,7 @@ static bool Equal(const Vector<String>& a, const Vector<String>& b) { if (a.size() != b.size()) return false; - for (size_t i = 0; i < a.size(); i++) { + for (wtf_size_t i = 0; i < a.size(); i++) { if (a[i] != b[i]) return false; } @@ -262,7 +261,7 @@ css_property_whitelist_ = std::make_unique<CSSPropertyWhitelist>(); // Look up the CSSPropertyIDs for each entry in |style_whitelist|. - for (size_t i = 0; i < style_whitelist->length(); i++) { + for (wtf_size_t i = 0; i < style_whitelist->length(); i++) { CSSPropertyID property_id = cssPropertyID(style_whitelist->get(i)); if (property_id == CSSPropertyInvalid) continue; @@ -358,7 +357,7 @@ .setNodeType(static_cast<int>(node->getNodeType())) .setNodeName(node->nodeName()) .setNodeValue(node_value) - .setBackendNodeId(DOMNodeIds::IdForNode(node)) + .setBackendNodeId(IdentifiersFactory::IntIdForNode(node)) .build(); if (origin_url_map_ && origin_url_map_->Contains(owned_value->getBackendNodeId())) { @@ -372,7 +371,7 @@ } } protocol::DOMSnapshot::DOMNode* value = owned_value.get(); - int index = dom_nodes_->length(); + int index = static_cast<int>(dom_nodes_->length()); dom_nodes_->addItem(std::move(owned_value)); int layoutNodeIndex = @@ -494,7 +493,7 @@ auto it = string_table_.find(string); int index; if (it == string_table_.end()) { - index = strings_->length(); + index = static_cast<int>(strings_->length()); strings_->addItem(string); string_table_.Set(string, index); } else { @@ -605,8 +604,8 @@ } auto* nodes = document_->getNodes(); - int index = nodes->getNodeName(nullptr)->length(); - int backend_node_id = DOMNodeIds::IdForNode(node); + int index = static_cast<int>(nodes->getNodeName(nullptr)->length()); + DOMNodeId backend_node_id = DOMNodeIds::IdForNode(node); // Create DOMNode object and add it to the result array before traversing // children, so that parents appear before their children in the array. @@ -615,7 +614,8 @@ nodes->getNodeType(nullptr)->addItem(static_cast<int>(node->getNodeType())); nodes->getNodeName(nullptr)->addItem(AddString(node->nodeName())); nodes->getNodeValue(nullptr)->addItem(AddString(node_value)); - nodes->getBackendNodeId(nullptr)->addItem(backend_node_id); + nodes->getBackendNodeId(nullptr)->addItem( + IdentifiersFactory::IntIdForNode(node)); nodes->getAttributes(nullptr)->addItem(BuildArrayForElementAttributes2(node)); BuildLayoutTreeNode(node->GetLayoutObject(), node, index); @@ -866,15 +866,16 @@ if (layout_object->IsText()) { LayoutText* layout_text = ToLayoutText(layout_object); layout_tree_node->setLayoutText(layout_text->GetText()); - if (layout_text->HasTextBoxes()) { + Vector<LayoutText::TextBoxInfo> text_boxes = layout_text->GetTextBoxInfo(); + if (!text_boxes.IsEmpty()) { std::unique_ptr<protocol::Array<protocol::DOMSnapshot::InlineTextBox>> inline_text_nodes = protocol::Array<protocol::DOMSnapshot::InlineTextBox>::create(); - for (const InlineTextBox* text_box : layout_text->TextBoxes()) { + for (const auto& text_box : text_boxes) { inline_text_nodes->addItem( protocol::DOMSnapshot::InlineTextBox::create() - .setStartCharacterIndex(text_box->Start()) - .setNumCharacters(text_box->Len()) + .setStartCharacterIndex(text_box.dom_start_offset) + .setNumCharacters(text_box.dom_length) .setBoundingBox(BuildRectForLayoutRect( TextFragmentRectInDocument(layout_object, text_box))) .build()); @@ -883,7 +884,7 @@ } } - int index = layout_tree_nodes_->length(); + int index = static_cast<int>(layout_tree_nodes_->length()); layout_tree_nodes_->addItem(std::move(layout_tree_node)); return index; } @@ -896,7 +897,8 @@ auto* layout_tree_snapshot = document_->getLayout(); auto* text_box_snapshot = document_->getTextBoxes(); - int layout_index = layout_tree_snapshot->getNodeIndex()->length(); + int layout_index = + static_cast<int>(layout_tree_snapshot->getNodeIndex()->length()); layout_tree_snapshot->getNodeIndex()->addItem(node_index); layout_tree_snapshot->getStyles()->addItem(BuildStylesForNode(node)); layout_tree_snapshot->getBounds()->addItem( @@ -913,15 +915,16 @@ return layout_index; LayoutText* layout_text = ToLayoutText(layout_object); - if (!layout_text->HasTextBoxes()) + Vector<LayoutText::TextBoxInfo> text_boxes = layout_text->GetTextBoxInfo(); + if (text_boxes.IsEmpty()) return layout_index; - for (const InlineTextBox* text_box : layout_text->TextBoxes()) { + for (const auto& text_box : text_boxes) { text_box_snapshot->getLayoutIndex()->addItem(layout_index); text_box_snapshot->getBounds()->addItem(BuildRectForLayoutRect2( TextFragmentRectInDocument(layout_object, text_box))); - text_box_snapshot->getStart()->addItem(text_box->Start()); - text_box_snapshot->getLength()->addItem(text_box->Len()); + text_box_snapshot->getStart()->addItem(text_box.dom_start_offset); + text_box_snapshot->getLength()->addItem(text_box.dom_length); } return layout_index; @@ -952,7 +955,7 @@ auto style_properties = protocol::Array<protocol::DOMSnapshot::NameValue>::create(); - for (size_t i = 0; i < style.size(); i++) { + for (wtf_size_t i = 0; i < style.size(); i++) { if (style[i].IsEmpty()) continue; style_properties->addItem(protocol::DOMSnapshot::NameValue::create() @@ -961,7 +964,7 @@ .build()); } - size_t index = computed_styles_->length(); + wtf_size_t index = static_cast<wtf_size_t>(computed_styles_->length()); computed_styles_->addItem(protocol::DOMSnapshot::ComputedStyle::create() .setProperties(std::move(style_properties)) .build());
diff --git a/third_party/blink/renderer/core/inspector/inspector_emulation_agent.cc b/third_party/blink/renderer/core/inspector/inspector_emulation_agent.cc index 479cdb0..289ef755 100644 --- a/third_party/blink/renderer/core/inspector/inspector_emulation_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_emulation_agent.cc
@@ -422,7 +422,7 @@ default_background_color_override_rgba_.Set( rgba->toValue()->serialize()); // Clamping of values is done by Color() constructor. - int alpha = lroundf(255.0f * rgba->getA(1.0f)); + int alpha = static_cast<int>(lroundf(255.0f * rgba->getA(1.0f))); GetWebViewImpl()->SetBaseBackgroundColorOverride( Color(rgba->getR(), rgba->getG(), rgba->getB(), alpha).Rgb()); return Response::OK();
diff --git a/third_party/blink/renderer/core/inspector/inspector_highlight.cc b/third_party/blink/renderer/core/inspector/inspector_highlight.cc index 1c2c531..2132b81f 100644 --- a/third_party/blink/renderer/core/inspector/inspector_highlight.cc +++ b/third_party/blink/renderer/core/inspector/inspector_highlight.cc
@@ -208,8 +208,8 @@ if (real_element->HasClass() && real_element->IsStyledElement()) { HashSet<AtomicString> used_class_names; const SpaceSplitString& class_names_string = real_element->ClassNames(); - size_t class_name_count = class_names_string.size(); - for (size_t i = 0; i < class_name_count; ++i) { + wtf_size_t class_name_count = class_names_string.size(); + for (wtf_size_t i = 0; i < class_name_count; ++i) { const AtomicString& class_name = class_names_string[i]; if (!used_class_names.insert(class_name).is_new_entry) continue; @@ -428,7 +428,7 @@ Vector<FloatQuad> svg_quads; if (BuildSVGQuads(node, svg_quads)) { - for (size_t i = 0; i < svg_quads.size(); ++i) { + for (wtf_size_t i = 0; i < svg_quads.size(); ++i) { AppendQuad(svg_quads[i], content_color, highlight_config.content_outline); } return;
diff --git a/third_party/blink/renderer/core/inspector/inspector_history.h b/third_party/blink/renderer/core/inspector/inspector_history.h index 119c083..d45e3ed 100644 --- a/third_party/blink/renderer/core/inspector/inspector_history.h +++ b/third_party/blink/renderer/core/inspector/inspector_history.h
@@ -79,7 +79,7 @@ private: HeapVector<Member<Action>> history_; - size_t after_last_action_index_; + wtf_size_t after_last_action_index_; DISALLOW_COPY_AND_ASSIGN(InspectorHistory); };
diff --git a/third_party/blink/renderer/core/inspector/inspector_layer_tree_agent.cc b/third_party/blink/renderer/core/inspector/inspector_layer_tree_agent.cc index 8b58a48..4ef3fa6 100644 --- a/third_party/blink/renderer/core/inspector/inspector_layer_tree_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_layer_tree_agent.cc
@@ -131,7 +131,7 @@ CompositorElementId element_id) { if (root->CcLayer()->element_id() == element_id) return root; - for (size_t i = 0, size = root->Children().size(); i < size; ++i) { + for (wtf_size_t i = 0, size = root->Children().size(); i < size; ++i) { if (GraphicsLayer* layer = FindLayerByElementId(root->Children()[i], element_id)) return layer; @@ -327,7 +327,7 @@ GraphicsLayer* graphics_layer = root->GetCompositedLayerMapping()->ChildForSuperlayers(); layer_id_to_node_id_map.Set(graphics_layer->CcLayer()->id(), - IdForNode(node)); + IdentifiersFactory::IntIdForNode(node)); } } for (PaintLayer* child = root->FirstChild(); child; @@ -362,15 +362,11 @@ layers->addItem(BuildObjectForLayer( RootGraphicsLayer(), layer, layer_id_to_node_id_map.at(layer_id), has_wheel_event_handlers && layer_id == scrolling_layer_id)); - for (size_t i = 0, size = layer->Children().size(); i < size; ++i) + for (wtf_size_t i = 0, size = layer->Children().size(); i < size; ++i) GatherGraphicsLayers(layer->Children()[i], layer_id_to_node_id_map, layers, has_wheel_event_handlers, scrolling_layer_id); } -int InspectorLayerTreeAgent::IdForNode(Node* node) { - return DOMNodeIds::IdForNode(node); -} - PaintLayerCompositor* InspectorLayerTreeAgent::GetPaintLayerCompositor() { auto* layout_view = inspected_frames_->Root()->ContentLayoutObject(); PaintLayerCompositor* compositor = @@ -388,7 +384,7 @@ static GraphicsLayer* FindLayerById(GraphicsLayer* root, int layer_id) { if (root->CcLayer()->id() == layer_id) return root; - for (size_t i = 0, size = root->Children().size(); i < size; ++i) { + for (wtf_size_t i = 0, size = root->Children().size(); i < size; ++i) { if (GraphicsLayer* layer = FindLayerById(root->Children()[i], layer_id)) return layer; } @@ -473,9 +469,12 @@ String* snapshot_id) { if (!tiles->length()) return Response::Error("Invalid argument, no tiles provided"); + if (tiles->length() > UINT_MAX) + return Response::Error("Invalid argument, too many tiles provided"); + wtf_size_t tiles_length = static_cast<wtf_size_t>(tiles->length()); Vector<scoped_refptr<PictureSnapshot::TilePictureStream>> decoded_tiles; - decoded_tiles.Grow(tiles->length()); - for (size_t i = 0; i < tiles->length(); ++i) { + decoded_tiles.Grow(tiles_length); + for (wtf_size_t i = 0; i < tiles_length; ++i) { protocol::LayerTree::PictureTile* tile = tiles->get(i); decoded_tiles[i] = base::AdoptRef(new PictureSnapshot::TilePictureStream()); decoded_tiles[i]->layer_offset.Set(tile->getX(), tile->getY());
diff --git a/third_party/blink/renderer/core/inspector/inspector_layer_tree_agent.h b/third_party/blink/renderer/core/inspector/inspector_layer_tree_agent.h index f88bc20..8b68ba1 100644 --- a/third_party/blink/renderer/core/inspector/inspector_layer_tree_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_layer_tree_agent.h
@@ -124,7 +124,6 @@ std::unique_ptr<protocol::Array<protocol::LayerTree::Layer>>&, bool has_wheel_event_handlers, int scrolling_root_layer_id); - int IdForNode(Node*); Member<InspectedFrames> inspected_frames_; Client* client_;
diff --git a/third_party/blink/renderer/core/inspector/inspector_log_agent.cc b/third_party/blink/renderer/core/inspector/inspector_log_agent.cc index a0f3790..651c0a9 100644 --- a/third_party/blink/renderer/core/inspector/inspector_log_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_log_agent.cc
@@ -176,7 +176,7 @@ GetFrontend()->entryAdded(std::move(expired)); GetFrontend()->flush(); } - for (size_t i = 0; i < storage_->size(); ++i) + for (wtf_size_t i = 0; i < storage_->size(); ++i) ConsoleMessageAdded(storage_->at(i)); }
diff --git a/third_party/blink/renderer/core/inspector/inspector_network_agent.cc b/third_party/blink/renderer/core/inspector/inspector_network_agent.cc index 4cb5a75..66ceadc 100644 --- a/third_party/blink/renderer/core/inspector/inspector_network_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_network_agent.cc
@@ -105,7 +105,7 @@ bool Matches(const String& url, const String& pattern) { Vector<String> parts; pattern.Split("*", parts); - size_t pos = 0; + wtf_size_t pos = 0; for (const String& part : parts) { pos = url.Find(part, pos); if (pos == kNotFound) @@ -234,7 +234,7 @@ return; parts_.Grow(request_body->Elements().size()); - for (size_t i = 0; i < request_body->Elements().size(); i++) { + for (wtf_size_t i = 0; i < request_body->Elements().size(); i++) { const FormDataElement& data = request_body->Elements()[i]; switch (data.type_) { case FormDataElement::kData: @@ -940,8 +940,10 @@ // If we revalidated the resource and got Not modified, send content length // following didReceiveResponse as there will be no calls to didReceiveData // from the network stack. - if (is_not_modified && cached_resource && cached_resource->EncodedSize()) - DidReceiveData(identifier, loader, nullptr, cached_resource->EncodedSize()); + if (is_not_modified && cached_resource && cached_resource->EncodedSize()) { + DidReceiveData(identifier, loader, nullptr, + static_cast<int>(cached_resource->EncodedSize())); + } } static bool IsErrorStatusCode(int status_code) {
diff --git a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc index a07b7d48..5cab6b9b 100644 --- a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc
@@ -270,8 +270,10 @@ if (!dom_agent_->Enabled()) return Response::Error("DOM should be enabled first"); enabled_.Set(true); - if (backend_node_id_to_inspect_) - GetFrontend()->inspectNodeRequested(backend_node_id_to_inspect_); + if (backend_node_id_to_inspect_) { + GetFrontend()->inspectNodeRequested( + static_cast<int>(backend_node_id_to_inspect_)); + } backend_node_id_to_inspect_ = 0; return Response::OK(); } @@ -1119,13 +1121,13 @@ if (!node) return; - int backend_node_id = DOMNodeIds::IdForNode(node); + DOMNodeId backend_node_id = DOMNodeIds::IdForNode(node); if (!enabled_.Get()) { backend_node_id_to_inspect_ = backend_node_id; return; } - GetFrontend()->inspectNodeRequested(backend_node_id); + GetFrontend()->inspectNodeRequested(IdentifiersFactory::IntIdForNode(node)); } void InspectorOverlayAgent::NodeHighlightRequested(Node* node) {
diff --git a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.h b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.h index c2354e32..fc4c27d 100644 --- a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.h
@@ -35,6 +35,7 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/dom/dom_node_ids.h" #include "third_party/blink/renderer/core/inspector/inspector_base_agent.h" #include "third_party/blink/renderer/core/inspector/inspector_highlight.h" #include "third_party/blink/renderer/core/inspector/inspector_overlay_host.h" @@ -213,7 +214,7 @@ bool swallow_next_mouse_up_; SearchMode inspect_mode_; std::unique_ptr<InspectorHighlightConfig> inspect_mode_highlight_config_; - int backend_node_id_to_inspect_; + DOMNodeId backend_node_id_to_inspect_; bool screenshot_mode_ = false; IntPoint screenshot_anchor_; IntPoint screenshot_position_;
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc index 5f31c03..a66248c6 100644 --- a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
@@ -238,7 +238,7 @@ static void MaybeEncodeTextContent(const String& text_content, const char* buffer_data, - size_t buffer_size, + wtf_size_t buffer_size, String* result, bool* base64_encoded) { if (!text_content.IsNull() && @@ -269,7 +269,8 @@ const SharedBuffer::DeprecatedFlatData flat_buffer(std::move(buffer)); return MaybeEncodeTextContent(text_content, flat_buffer.Data(), - flat_buffer.size(), result, base64_encoded); + SafeCast<wtf_size_t>(flat_buffer.size()), + result, base64_encoded); } // static @@ -299,11 +300,13 @@ text_content = decoder->Decode(flat_buffer.Data(), flat_buffer.size()); text_content = text_content + decoder->Flush(); } else if (encoding.IsValid()) { - text_content = encoding.Decode(flat_buffer.Data(), flat_buffer.size()); + text_content = encoding.Decode(flat_buffer.Data(), + SafeCast<wtf_size_t>(flat_buffer.size())); } - MaybeEncodeTextContent(text_content, flat_buffer.Data(), flat_buffer.size(), - result, base64_encoded); + MaybeEncodeTextContent(text_content, flat_buffer.Data(), + SafeCast<wtf_size_t>(flat_buffer.size()), result, + base64_encoded); return true; } @@ -323,7 +326,8 @@ return false; const SharedBuffer::DeprecatedFlatData flat_buffer(std::move(buffer)); - *result = Base64Encode(flat_buffer.Data(), flat_buffer.size()); + *result = Base64Encode(flat_buffer.Data(), + SafeCast<wtf_size_t>(flat_buffer.size())); *base64_encoded = true; return true; } @@ -671,7 +675,7 @@ Document* root_document = frame->GetDocument(); if (HTMLImportsController* controller = root_document->ImportsController()) { - for (size_t i = 0; i < controller->LoaderCount(); ++i) { + for (wtf_size_t i = 0; i < controller->LoaderCount(); ++i) { if (Document* document = controller->LoaderAt(i)->GetDocument()) result.push_back(document); } @@ -688,7 +692,7 @@ InspectorPageAgent::ImportsForFrame(frame); CachedResourcesForDocument(root_document, result, skip_xhrs); - for (size_t i = 0; i < loaders.size(); ++i) + for (wtf_size_t i = 0; i < loaders.size(); ++i) CachedResourcesForDocument(loaders[i], result, skip_xhrs); return result;
diff --git a/third_party/blink/renderer/core/inspector/inspector_resource_container.cc b/third_party/blink/renderer/core/inspector/inspector_resource_container.cc index 2e02b7bd..658fceb2 100644 --- a/third_party/blink/renderer/core/inspector/inspector_resource_container.cc +++ b/third_party/blink/renderer/core/inspector/inspector_resource_container.cc
@@ -39,20 +39,22 @@ } void InspectorResourceContainer::StoreStyleElementContent( - int backend_node_id, + DOMNodeId backend_node_id, const String& content) { style_element_contents_.Set(backend_node_id, content); } -bool InspectorResourceContainer::LoadStyleElementContent(int backend_node_id, - String* content) { +bool InspectorResourceContainer::LoadStyleElementContent( + DOMNodeId backend_node_id, + String* content) { if (!style_element_contents_.Contains(backend_node_id)) return false; *content = style_element_contents_.at(backend_node_id); return true; } -void InspectorResourceContainer::EraseStyleElementContent(int backend_node_id) { +void InspectorResourceContainer::EraseStyleElementContent( + DOMNodeId backend_node_id) { style_element_contents_.erase(backend_node_id); }
diff --git a/third_party/blink/renderer/core/inspector/inspector_resource_container.h b/third_party/blink/renderer/core/inspector/inspector_resource_container.h index 9595e6e2..74bd997 100644 --- a/third_party/blink/renderer/core/inspector/inspector_resource_container.h +++ b/third_party/blink/renderer/core/inspector/inspector_resource_container.h
@@ -7,6 +7,7 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/dom/dom_node_ids.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" @@ -30,14 +31,15 @@ void StoreStyleSheetContent(const String& url, const String& content); bool LoadStyleSheetContent(const String& url, String* content); - void StoreStyleElementContent(int backend_node_id, const String& content); - bool LoadStyleElementContent(int backend_node_id, String* content); - void EraseStyleElementContent(int backend_node_id); + void StoreStyleElementContent(DOMNodeId backend_node_id, + const String& content); + bool LoadStyleElementContent(DOMNodeId backend_node_id, String* content); + void EraseStyleElementContent(DOMNodeId backend_node_id); private: Member<InspectedFrames> inspected_frames_; HashMap<String, String> style_sheet_contents_; - HashMap<int, String> style_element_contents_; + HashMap<DOMNodeId, String> style_element_contents_; DISALLOW_COPY_AND_ASSIGN(InspectorResourceContainer); };
diff --git a/third_party/blink/renderer/core/inspector/inspector_session.cc b/third_party/blink/renderer/core/inspector/inspector_session.cc index 1defb5c0..e11532cc2 100644 --- a/third_party/blink/renderer/core/inspector/inspector_session.cc +++ b/third_party/blink/renderer/core/inspector/inspector_session.cc
@@ -66,7 +66,7 @@ void InspectorSession::Restore() { DCHECK(!disposed_); - for (size_t i = 0; i < agents_.size(); i++) + for (wtf_size_t i = 0; i < agents_.size(); i++) agents_[i]->Restore(); } @@ -74,7 +74,7 @@ DCHECK(!disposed_); disposed_ = true; inspector_backend_dispatcher_.reset(); - for (size_t i = agents_.size(); i > 0; i--) + for (wtf_size_t i = agents_.size(); i > 0; i--) agents_[i - 1]->Dispose(); agents_.clear(); v8_session_.reset(); @@ -113,7 +113,7 @@ } void InspectorSession::DidCommitLoadForLocalFrame(LocalFrame* frame) { - for (size_t i = 0; i < agents_.size(); i++) + for (wtf_size_t i = 0; i < agents_.size(); i++) agents_[i]->DidCommitLoadForLocalFrame(frame); } @@ -206,12 +206,12 @@ void InspectorSession::flushProtocolNotifications() { if (disposed_) return; - for (size_t i = 0; i < agents_.size(); i++) + for (wtf_size_t i = 0; i < agents_.size(); i++) agents_[i]->FlushPendingProtocolNotifications(); if (!notification_queue_.size()) return; v8_session_state_json_.Set(ToCoreString(v8_session_->stateJSON())); - for (size_t i = 0; i < notification_queue_.size(); ++i) { + for (wtf_size_t i = 0; i < notification_queue_.size(); ++i) { client_->SendProtocolNotification(session_id_, notification_queue_[i]->Serialize(), session_state_.TakeUpdates());
diff --git a/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc b/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc index 9a06aae..a2e86069 100644 --- a/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc +++ b/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc
@@ -73,13 +73,13 @@ String FindMagicComment(const String& content, const String& name) { DCHECK(name.Find("=") == kNotFound); - unsigned length = content.length(); - unsigned name_length = name.length(); + wtf_size_t length = content.length(); + wtf_size_t name_length = name.length(); const bool kMultiline = true; - size_t pos = length; - size_t equal_sign_pos = 0; - size_t closing_comment_pos = 0; + wtf_size_t pos = length; + wtf_size_t equal_sign_pos = 0; + wtf_size_t closing_comment_pos = 0; while (true) { pos = content.ReverseFind(name, pos); if (pos == kNotFound) @@ -112,18 +112,18 @@ DCHECK(equal_sign_pos); DCHECK(!kMultiline || closing_comment_pos); - size_t url_pos = equal_sign_pos + 1; + wtf_size_t url_pos = equal_sign_pos + 1; String match = kMultiline ? content.Substring(url_pos, closing_comment_pos - url_pos) : content.Substring(url_pos); - size_t new_line = match.Find("\n"); + wtf_size_t new_line = match.Find("\n"); if (new_line != kNotFound) match = match.Substring(0, new_line); match = match.StripWhiteSpace(); String disallowed_chars("\"' \t"); - for (unsigned i = 0; i < match.length(); ++i) { + for (uint32_t i = 0; i < match.length(); ++i) { if (disallowed_chars.find(match[i]) != kNotFound) return g_empty_string; } @@ -280,7 +280,7 @@ .StripWhiteSpace(); if (property_string.EndsWith(';')) property_string = property_string.Left(property_string.length() - 1); - size_t colon_index = property_string.find(':'); + wtf_size_t colon_index = property_string.find(':'); DCHECK_NE(colon_index, kNotFound); String name = property_string.Left(colon_index).StripWhiteSpace(); @@ -558,7 +558,7 @@ IndexMap* a_to_b, IndexMap* b_to_a) { // Cut of common prefix. - size_t start_offset = 0; + wtf_size_t start_offset = 0; while (start_offset < list_a.size() && start_offset < list_b.size()) { if (list_a.at(start_offset) != list_b.at(start_offset)) break; @@ -568,11 +568,11 @@ } // Cut of common suffix. - size_t end_offset = 0; + wtf_size_t end_offset = 0; while (end_offset < list_a.size() - start_offset && end_offset < list_b.size() - start_offset) { - size_t index_a = list_a.size() - end_offset - 1; - size_t index_b = list_b.size() - end_offset - 1; + wtf_size_t index_a = list_a.size() - end_offset - 1; + wtf_size_t index_b = list_b.size() - end_offset - 1; if (list_a.at(index_a) != list_b.at(index_b)) break; a_to_b->Set(index_a, index_b); @@ -580,8 +580,8 @@ ++end_offset; } - int n = list_a.size() - start_offset - end_offset; - int m = list_b.size() - start_offset - end_offset; + wtf_size_t n = list_a.size() - start_offset - end_offset; + wtf_size_t m = list_b.size() - start_offset - end_offset; // If we mapped either of arrays, we have no more work to do. if (n == 0 || m == 0) @@ -589,14 +589,14 @@ int** diff = new int*[n]; int** backtrack = new int*[n]; - for (int i = 0; i < n; ++i) { + for (wtf_size_t i = 0; i < n; ++i) { diff[i] = new int[m]; backtrack[i] = new int[m]; } // Compute longest common subsequence of two cssom models. - for (int i = 0; i < n; ++i) { - for (int j = 0; j < m; ++j) { + for (wtf_size_t i = 0; i < n; ++i) { + for (wtf_size_t j = 0; j < m; ++j) { int max = 0; int track = 0; @@ -644,7 +644,7 @@ } } - for (int i = 0; i < n; ++i) { + for (wtf_size_t i = 0; i < n; ++i) { delete[] diff[i]; delete[] backtrack[i]; } @@ -1237,7 +1237,7 @@ DCHECK(source_data_); CSSRuleSourceData* containing_rule_source_data = nullptr; - for (size_t i = 0; i < source_data_->size(); ++i) { + for (wtf_size_t i = 0; i < source_data_->size(); ++i) { CSSRuleSourceData* rule_source_data = source_data_->at(i).Get(); if (rule_source_data->rule_header_range.start < source_range.start && source_range.start < rule_source_data->rule_body_range.start) { @@ -1317,7 +1317,7 @@ // Find index of CSSRule that entirely belongs to the range. CSSRuleSourceData* found_data = nullptr; - for (size_t i = 0; i < source_data_->size(); ++i) { + for (wtf_size_t i = 0; i < source_data_->size(); ++i) { CSSRuleSourceData* rule_source_data = source_data_->at(i).Get(); unsigned rule_start = rule_source_data->rule_header_range.start; unsigned rule_end = rule_source_data->rule_body_range.end + 1; @@ -1354,14 +1354,14 @@ return false; } CSSMediaRule* parent_media_rule = ToCSSMediaRule(parent_rule); - size_t index = 0; + wtf_size_t index = 0; while (index < parent_media_rule->length() && parent_media_rule->Item(index) != rule) ++index; DCHECK_LT(index, parent_media_rule->length()); parent_media_rule->deleteRule(index, exception_state); } else { - size_t index = 0; + wtf_size_t index = 0; while (index < style_sheet->length() && style_sheet->item(index) != rule) ++index; DCHECK_LT(index, style_sheet->length()); @@ -1383,7 +1383,7 @@ std::unique_ptr<protocol::Array<String>> result = protocol::Array<String>::create(); - for (size_t i = 0; i < parsed_flat_rules_.size(); ++i) { + for (wtf_size_t i = 0; i < parsed_flat_rules_.size(); ++i) { if (parsed_flat_rules_.at(i)->type() == CSSRule::kStyleRule) GetClassNamesFromRule(ToCSSStyleRule(parsed_flat_rules_.at(i)), unique_names); @@ -1474,8 +1474,10 @@ if (HasSourceURL()) result->setHasSourceURL(true); - if (style_sheet->ownerNode()) - result->setOwnerNode(DOMNodeIds::IdForNode(style_sheet->ownerNode())); + if (style_sheet->ownerNode()) { + result->setOwnerNode( + IdentifiersFactory::IntIdForNode(style_sheet->ownerNode())); + } String source_map_url_value = SourceMapURL(); if (!source_map_url_value.IsEmpty()) @@ -1490,7 +1492,7 @@ std::unique_ptr<protocol::Array<protocol::CSS::Value>> result = protocol::Array<protocol::CSS::Value>::create(); const Vector<SourceRange>& ranges = source_data->selector_ranges; - for (size_t i = 0, size = ranges.size(); i < size; ++i) { + for (wtf_size_t i = 0, size = ranges.size(); i < size; ++i) { const SourceRange& range = ranges.at(i); String selector = sheet_text.Substring(range.start, range.length()); @@ -1620,8 +1622,8 @@ std::unique_ptr<protocol::CSS::SourceRange> InspectorStyleSheet::MediaQueryExpValueSourceRange( CSSRule* rule, - size_t media_query_index, - size_t media_query_exp_index) { + wtf_size_t media_query_index, + wtf_size_t media_query_exp_index) { if (!source_data_) return nullptr; CSSRuleSourceData* source_data = SourceDataForRule(rule); @@ -1715,7 +1717,7 @@ if (!source_data_) return nullptr; - for (size_t i = 0; i < source_data_->size(); ++i) { + for (wtf_size_t i = 0; i < source_data_->size(); ++i) { CSSRuleSourceData* rule_source_data = source_data_->at(i).Get(); if (rule_source_data->rule_header_range.start == source_range.start && rule_source_data->rule_header_range.end == source_range.end) { @@ -1730,7 +1732,7 @@ if (!source_data_) return nullptr; - for (size_t i = 0; i < source_data_->size(); ++i) { + for (wtf_size_t i = 0; i < source_data_->size(); ++i) { CSSRuleSourceData* rule_source_data = source_data_->at(i).Get(); if (rule_source_data->rule_body_range.start == source_range.start && rule_source_data->rule_body_range.end == source_range.end) { @@ -1747,7 +1749,7 @@ RemapSourceDataToCSSOMIfNecessary(); - size_t index = source_data_->Find(source_data); + wtf_size_t index = source_data_->Find(source_data); if (index == kNotFound) return nullptr; IndexMap::iterator it = source_data_to_rule_.find(index); @@ -1770,7 +1772,7 @@ RemapSourceDataToCSSOMIfNecessary(); - size_t index = cssom_flat_rules_.Find(rule); + wtf_size_t index = cssom_flat_rules_.Find(rule); if (index == kNotFound) return nullptr; IndexMap::iterator it = rule_to_source_data_.find(index); @@ -1795,7 +1797,7 @@ return; } - for (size_t i = 0; i < cssom_flat_rules_.size(); ++i) { + for (wtf_size_t i = 0; i < cssom_flat_rules_.size(); ++i) { if (cssom_flat_rules_.at(i) != cssom_rules.at(i)) { MapSourceDataToCSSOM(); return; @@ -1818,9 +1820,9 @@ Vector<String> cssom_rules_text = Vector<String>(); Vector<String> parsed_rules_text = Vector<String>(); - for (size_t i = 0; i < cssom_rules.size(); ++i) + for (wtf_size_t i = 0; i < cssom_rules.size(); ++i) cssom_rules_text.push_back(CanonicalCSSText(cssom_rules.at(i))); - for (size_t j = 0; j < parsed_rules.size(); ++j) + for (wtf_size_t j = 0; j < parsed_rules.size(); ++j) parsed_rules_text.push_back(CanonicalCSSText(parsed_rules.at(j))); Diff(cssom_rules_text, parsed_rules_text, &rule_to_source_data_,
diff --git a/third_party/blink/renderer/core/inspector/inspector_style_sheet.h b/third_party/blink/renderer/core/inspector/inspector_style_sheet.h index 8fde3fb4..abfd1e9b4 100644 --- a/third_party/blink/renderer/core/inspector/inspector_style_sheet.h +++ b/third_party/blink/renderer/core/inspector/inspector_style_sheet.h
@@ -181,8 +181,8 @@ std::unique_ptr<protocol::CSS::SourceRange> RuleHeaderSourceRange(CSSRule*); std::unique_ptr<protocol::CSS::SourceRange> MediaQueryExpValueSourceRange( CSSRule*, - size_t media_query_index, - size_t media_query_exp_index); + wtf_size_t media_query_index, + wtf_size_t media_query_exp_index); bool IsInlineStyle() override { return false; } const CSSRuleVector& FlatRules(); CSSRuleSourceData* SourceDataForRule(CSSRule*);
diff --git a/third_party/blink/renderer/core/inspector/inspector_trace_events.cc b/third_party/blink/renderer/core/inspector/inspector_trace_events.cc index df8c825..b62a1b8 100644 --- a/third_party/blink/renderer/core/inspector/inspector_trace_events.cc +++ b/third_party/blink/renderer/core/inspector/inspector_trace_events.cc
@@ -17,7 +17,6 @@ #include "third_party/blink/renderer/core/animation/keyframe_effect.h" #include "third_party/blink/renderer/core/css/invalidation/invalidation_set.h" #include "third_party/blink/renderer/core/css/style_change_reason.h" -#include "third_party/blink/renderer/core/dom/dom_node_ids.h" #include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" @@ -221,7 +220,8 @@ Node* node, const char* id_field_name, const char* name_field_name = nullptr) { - value->SetIntegerWithCopiedName(id_field_name, DOMNodeIds::IdForNode(node)); + value->SetIntegerWithCopiedName(id_field_name, + IdentifiersFactory::IntIdForNode(node)); if (name_field_name) value->SetStringWithCopiedName(name_field_name, node->DebugName()); } @@ -868,7 +868,7 @@ TimeDelta timeout, bool single_shot) { std::unique_ptr<TracedValue> value = GenericTimerData(context, timer_id); - value->SetInteger("timeout", timeout.InMilliseconds()); + value->SetDouble("timeout", timeout.InMillisecondsF()); value->SetBoolean("singleShot", single_shot); SetCallStack(value.get()); return value; @@ -1049,8 +1049,8 @@ FrameOwner* owner = frame->Owner(); if (owner && owner->IsLocal()) { - frame_data->SetInteger( - "nodeId", DOMNodeIds::IdForNode(ToHTMLFrameOwnerElement(owner))); + frame_data->SetInteger("nodeId", IdentifiersFactory::IntIdForNode( + ToHTMLFrameOwnerElement(owner))); } Frame* parent = frame->Tree().Parent(); if (parent && parent->IsLocalFrame())
diff --git a/third_party/blink/renderer/core/inspector/main_thread_debugger.cc b/third_party/blink/renderer/core/inspector/main_thread_debugger.cc index e65508d..f0fb537 100644 --- a/third_party/blink/renderer/core/inspector/main_thread_debugger.cc +++ b/third_party/blink/renderer/core/inspector/main_thread_debugger.cc
@@ -420,7 +420,7 @@ v8::Isolate* isolate = info.GetIsolate(); v8::Local<v8::Context> context = isolate->GetCurrentContext(); v8::Local<v8::Array> nodes = v8::Array::New(isolate, element_list->length()); - for (size_t i = 0; i < element_list->length(); ++i) { + for (wtf_size_t i = 0; i < element_list->length(); ++i) { Element* element = element_list->item(i); if (!CreateDataPropertyInArray( context, nodes, i, ToV8(element, info.Holder(), info.GetIsolate())) @@ -462,7 +462,7 @@ v8::Isolate* isolate = info.GetIsolate(); v8::Local<v8::Context> context = isolate->GetCurrentContext(); v8::Local<v8::Array> nodes = v8::Array::New(isolate); - size_t index = 0; + wtf_size_t index = 0; while (Node* node = result->iterateNext(exception_state)) { if (exception_state.HadException()) return;
diff --git a/third_party/blink/renderer/core/inspector/network_resources_data.h b/third_party/blink/renderer/core/inspector/network_resources_data.h index 5db1ca6..18537410 100644 --- a/third_party/blink/renderer/core/inspector/network_resources_data.h +++ b/third_party/blink/renderer/core/inspector/network_resources_data.h
@@ -145,8 +145,8 @@ downloaded_file_blob_ = std::move(blob); } - int RawHeaderSize() const { return raw_header_size_; } - void SetRawHeaderSize(int size) { raw_header_size_ = size; } + int64_t RawHeaderSize() const { return raw_header_size_; } + void SetRawHeaderSize(int64_t size) { raw_header_size_ = size; } Vector<AtomicString> Certificate() { return certificate_; } void SetCertificate(const Vector<AtomicString>& certificate) { @@ -188,7 +188,7 @@ String mime_type_; String text_encoding_name_; - int raw_header_size_; + int64_t raw_header_size_; int pending_encoded_data_length_; scoped_refptr<SharedBuffer> buffer_;
diff --git a/third_party/blink/renderer/core/inspector/thread_debugger.cc b/third_party/blink/renderer/core/inspector/thread_debugger.cc index 790b00d..4781c23 100644 --- a/third_party/blink/renderer/core/inspector/thread_debugger.cc +++ b/third_party/blink/renderer/core/inspector/thread_debugger.cc
@@ -309,7 +309,7 @@ types.push_back(ToCoreString(info[1].As<v8::String>())); if (info.Length() > 1 && info[1]->IsArray()) { v8::Local<v8::Array> types_array = v8::Local<v8::Array>::Cast(info[1]); - for (size_t i = 0; i < types_array->Length(); ++i) { + for (wtf_size_t i = 0; i < types_array->Length(); ++i) { v8::Local<v8::Value> type_value; if (!types_array->Get(info.GetIsolate()->GetCurrentContext(), i) .ToLocal(&type_value) || @@ -329,7 +329,7 @@ "search", "devicemotion", "deviceorientation"})); Vector<String> output_types; - for (size_t i = 0; i < types.size(); ++i) { + for (wtf_size_t i = 0; i < types.size(); ++i) { if (types[i] == "mouse") output_types.AppendVector( Vector<String>({"auxclick", "click", "dblclick", "mousedown", @@ -379,7 +379,7 @@ enabled ? kListenerFindOrCreate : kListenerFindOnly); if (!event_listener) return; - for (size_t i = 0; i < types.size(); ++i) { + for (wtf_size_t i = 0; i < types.size(); ++i) { if (enabled) event_target->addEventListener(AtomicString(types[i]), event_listener, false); @@ -427,7 +427,7 @@ v8::Local<v8::Object> result = v8::Object::New(isolate); AtomicString current_event_type; v8::Local<v8::Array> listeners; - size_t output_index = 0; + wtf_size_t output_index = 0; for (auto& info : listener_info) { if (current_event_type != info.event_type) { current_event_type = info.event_type; @@ -500,7 +500,7 @@ } void ThreadDebugger::cancelTimer(void* data) { - for (size_t index = 0; index < timer_data_.size(); ++index) { + for (wtf_size_t index = 0; index < timer_data_.size(); ++index) { if (timer_data_[index] == data) { timers_[index]->Stop(); timer_callbacks_.EraseAt(index); @@ -512,7 +512,7 @@ } void ThreadDebugger::OnTimer(TimerBase* timer) { - for (size_t index = 0; index < timers_.size(); ++index) { + for (wtf_size_t index = 0; index < timers_.size(); ++index) { if (timers_[index].get() == timer) { timer_callbacks_[index](timer_data_[index]); return;
diff --git a/third_party/blink/renderer/core/inspector/v8_inspector_string.cc b/third_party/blink/renderer/core/inspector/v8_inspector_string.cc index 16e19f03..674a247 100644 --- a/third_party/blink/renderer/core/inspector/v8_inspector_string.cc +++ b/third_party/blink/renderer/core/inspector/v8_inspector_string.cc
@@ -26,11 +26,12 @@ } String ToCoreString(const v8_inspector::StringView& string) { - if (string.is8Bit()) + if (string.is8Bit()) { return String(reinterpret_cast<const LChar*>(string.characters8()), - string.length()); + SafeCast<wtf_size_t>(string.length())); + } return String(reinterpret_cast<const UChar*>(string.characters16()), - string.length()); + SafeCast<wtf_size_t>(string.length())); } String ToCoreString(std::unique_ptr<v8_inspector::StringBuffer> buffer) {
diff --git a/third_party/blink/renderer/core/inspector/v8_inspector_string.h b/third_party/blink/renderer/core/inspector/v8_inspector_string.h index 4cd4c93..0083f1a 100644 --- a/third_party/blink/renderer/core/inspector/v8_inspector_string.h +++ b/third_party/blink/renderer/core/inspector/v8_inspector_string.h
@@ -39,10 +39,11 @@ STATIC_ONLY(StringUtil); public: - static String substring(const String& s, unsigned pos, unsigned len) { - return s.Substring(pos, len); + static String substring(const String& s, size_t pos, size_t len) { + return s.Substring(static_cast<wtf_size_t>(pos), + static_cast<wtf_size_t>(len)); } - static String fromInteger(int number) { return String::Number(number); } + static String fromInteger(int64_t number) { return String::Number(number); } static String fromDouble(double number) { return Decimal::FromDouble(number).ToString(); } @@ -63,11 +64,11 @@ builder.Append(c); } static void builderAppend(StringBuilder& builder, const char* s, size_t len) { - builder.Append(s, len); + builder.Append(s, static_cast<wtf_size_t>(len)); } static void builderAppendQuotedString(StringBuilder&, const String&); - static void builderReserve(StringBuilder& builder, unsigned capacity) { - builder.ReserveCapacity(capacity); + static void builderReserve(StringBuilder& builder, uint64_t capacity) { + builder.ReserveCapacity(static_cast<wtf_size_t>(capacity)); } static String builderToString(StringBuilder& builder) { return builder.ToString();
diff --git a/third_party/blink/renderer/core/layout/layout_block.cc b/third_party/blink/renderer/core/layout/layout_block.cc index d6c00a07..4a912cc 100644 --- a/third_party/blink/renderer/core/layout/layout_block.cc +++ b/third_party/blink/renderer/core/layout/layout_block.cc
@@ -72,7 +72,7 @@ struct SameSizeAsLayoutBlock : public LayoutBox { LayoutObjectChildList children; - base::Optional<NGConstraintSpace> cached_constraint_space_; + std::unique_ptr<NGConstraintSpace> cached_constraint_space_; uint32_t bitfields; }; @@ -1996,13 +1996,11 @@ } const NGConstraintSpace* LayoutBlock::CachedConstraintSpace() const { - return cached_constraint_space_.has_value() - ? &cached_constraint_space_.value() - : nullptr; + return cached_constraint_space_.get(); } void LayoutBlock::SetCachedConstraintSpace(const NGConstraintSpace& space) { - cached_constraint_space_.emplace(space); + cached_constraint_space_.reset(new NGConstraintSpace(space)); } bool LayoutBlock::RecalcNormalFlowChildOverflowIfNeeded(
diff --git a/third_party/blink/renderer/core/layout/layout_block.h b/third_party/blink/renderer/core/layout/layout_block.h index d17d5db6..b64abaa 100644 --- a/third_party/blink/renderer/core/layout/layout_block.h +++ b/third_party/blink/renderer/core/layout/layout_block.h
@@ -538,7 +538,7 @@ virtual bool UpdateLogicalWidthAndColumnWidth(); LayoutObjectChildList children_; - base::Optional<NGConstraintSpace> cached_constraint_space_; + std::unique_ptr<NGConstraintSpace> cached_constraint_space_; unsigned has_margin_before_quirk_ : 1; // Note these quirk values can't be put
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index c2ac1d0e..5b25b2f 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -1122,12 +1122,14 @@ : nullptr; } -void LayoutBox::DispatchFakeMouseMoveEventSoon(EventHandler& event_handler) { +void LayoutBox::MayUpdateHoverWhenContentUnderMouseChanged( + EventHandler& event_handler) { const LayoutBoxModelObject& container = ContainerForPaintInvalidation(); - FloatQuad quad = + FloatQuad scroller_rect_in_frame = FloatQuad(FloatRect(VisualRectIncludingCompositedScrolling(container))); - quad = container.LocalToAbsoluteQuad(quad); - event_handler.DispatchFakeMouseMoveEventSoonInQuad(quad); + scroller_rect_in_frame = + container.LocalToAbsoluteQuad(scroller_rect_in_frame); + event_handler.MayUpdateHoverAfterScroll(scroller_rect_in_frame); } void LayoutBox::ScrollByRecursively(const ScrollOffset& delta) {
diff --git a/third_party/blink/renderer/core/layout/layout_box.h b/third_party/blink/renderer/core/layout/layout_box.h index f53d770..6055417 100644 --- a/third_party/blink/renderer/core/layout/layout_box.h +++ b/third_party/blink/renderer/core/layout/layout_box.h
@@ -1069,7 +1069,7 @@ const IntPoint& point_in_root_frame) const; static LayoutBox* FindAutoscrollable(LayoutObject*); virtual void StopAutoscroll() {} - virtual void DispatchFakeMouseMoveEventSoon(EventHandler&); + virtual void MayUpdateHoverWhenContentUnderMouseChanged(EventHandler&); DISABLE_CFI_PERF bool HasAutoVerticalScrollbar() const { return HasOverflowClip() && StyleRef().HasAutoVerticalScroll();
diff --git a/third_party/blink/renderer/core/layout/layout_text.cc b/third_party/blink/renderer/core/layout/layout_text.cc index 9d49ff24..72d5bf83 100644 --- a/third_party/blink/renderer/core/layout/layout_text.cc +++ b/third_party/blink/renderer/core/layout/layout_text.cc
@@ -128,6 +128,7 @@ known_to_have_no_overflow_and_no_fallback_fonts_(false), contains_only_whitespace_or_nbsp_( static_cast<unsigned>(OnlyWhitespaceOrNbsp::kUnknown)), + has_abstract_inline_text_box_(false), min_width_(-1), max_width_(-1), first_line_min_width_(0), @@ -256,8 +257,10 @@ // TODO(layout-dev): Because We should call |WillDestroy()| once for // associated fragments, when you reuse fragments, you should construct // NGAbstractInlineTextBox for them. - for (NGPaintFragment* fragment : NGPaintFragment::InlineFragmentsFor(this)) - NGAbstractInlineTextBox::WillDestroy(fragment); + if (has_abstract_inline_text_box_) { + for (NGPaintFragment* fragment : NGPaintFragment::InlineFragmentsFor(this)) + NGAbstractInlineTextBox::WillDestroy(fragment); + } first_paint_fragment_ = first_fragment; } @@ -2342,6 +2345,7 @@ first_letter_part ? first_letter_part : this); if (!fragments.IsEmpty() && fragments.IsInLayoutNGInlineFormattingContext()) { + has_abstract_inline_text_box_ = true; return NGAbstractInlineTextBox::GetOrCreate(LineLayoutText(this), **fragments.begin()); }
diff --git a/third_party/blink/renderer/core/layout/layout_text.h b/third_party/blink/renderer/core/layout/layout_text.h index 9db62fc..adf0d63 100644 --- a/third_party/blink/renderer/core/layout/layout_text.h +++ b/third_party/blink/renderer/core/layout/layout_text.h
@@ -418,6 +418,9 @@ unsigned contains_only_whitespace_or_nbsp_ : 2; private: + // Used for LayoutNG with accessibility. True if inline fragments are + // associated to |NGAbstractInlineTextBox|. + unsigned has_abstract_inline_text_box_ : 1; float min_width_; float max_width_; float first_line_min_width_;
diff --git a/third_party/blink/renderer/core/layout/layout_view.cc b/third_party/blink/renderer/core/layout/layout_view.cc index 8182986..3ecb4fd9 100644 --- a/third_party/blink/renderer/core/layout/layout_view.cc +++ b/third_party/blink/renderer/core/layout/layout_view.cc
@@ -735,9 +735,10 @@ #undef RETURN_SCROLLBAR_MODE } -void LayoutView::DispatchFakeMouseMoveEventSoon(EventHandler& event_handler) { - event_handler.DispatchFakeMouseMoveEventSoon( - MouseEventManager::FakeMouseMoveReason::kDuringScroll); +void LayoutView::MayUpdateHoverWhenContentUnderMouseChanged( + EventHandler& event_handler) { + event_handler.MayUpdateHoverWhenContentUnderMouseChanged( + MouseEventManager::UpdateHoverReason::kScrollOffsetChanged); } IntRect LayoutView::DocumentRect() const {
diff --git a/third_party/blink/renderer/core/layout/layout_view.h b/third_party/blink/renderer/core/layout/layout_view.h index 8d06cf0..26deb9f 100644 --- a/third_party/blink/renderer/core/layout/layout_view.h +++ b/third_party/blink/renderer/core/layout/layout_view.h
@@ -171,7 +171,7 @@ void CalculateScrollbarModes(ScrollbarMode& h_mode, ScrollbarMode& v_mode) const; - void DispatchFakeMouseMoveEventSoon(EventHandler&) override; + void MayUpdateHoverWhenContentUnderMouseChanged(EventHandler&) override; LayoutState* GetLayoutState() const { return layout_state_; }
diff --git a/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc b/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc index c1d4ec8..176a4413 100644 --- a/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc +++ b/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc
@@ -231,7 +231,7 @@ if (constraint_space.IsIntermediateLayout()) return; - Base::cached_constraint_space_.emplace(constraint_space); + Base::cached_constraint_space_.reset(new NGConstraintSpace(constraint_space)); cached_result_ = &layout_result; }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc index 9f05227..8434ab1c 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc
@@ -364,7 +364,7 @@ ? NGBoxStrut() : border_padding_ + scrollbars; child_available_size_ = - CalculateContentBoxSize(border_box_size, border_scrollbar_padding_); + ShrinkAvailableSize(border_box_size, border_scrollbar_padding_); // When the content box is smaller than the scrollbar, clamp the scrollbar. if (UNLIKELY(!child_available_size_.inline_size && scrollbars.InlineSum() && @@ -375,7 +375,7 @@ // Re-compute dependent values if scrollbar size was clamped. border_scrollbar_padding_ = border_padding_ + scrollbars; child_available_size_ = - CalculateContentBoxSize(border_box_size, border_scrollbar_padding_); + ShrinkAvailableSize(border_box_size, border_scrollbar_padding_); } child_percentage_size_ = CalculateChildPercentageSize(
diff --git a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc index b1776a8..0e73358c 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc
@@ -79,7 +79,7 @@ NGLogicalSize border_box_size = CalculateBorderBoxSize(ConstraintSpace(), Node()); NGLogicalSize content_box_size = - CalculateContentBoxSize(border_box_size, border_scrollbar_padding); + ShrinkAvailableSize(border_box_size, border_scrollbar_padding); NGLogicalSize column_size = CalculateColumnSize(content_box_size); WritingMode writing_mode = ConstraintSpace().GetWritingMode();
diff --git a/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h b/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h index 03bbebf2..f094e21f 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h +++ b/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h
@@ -45,7 +45,7 @@ // The NGConstraintSpace represents a set of constraints and available space // which a layout algorithm may produce a NGFragment within. class CORE_EXPORT NGConstraintSpace final { - DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); + USING_FAST_MALLOC(NGConstraintSpace); public: enum ConstraintSpaceFlags {
diff --git a/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc index e078254..080e6f1 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc
@@ -28,7 +28,7 @@ NGLogicalSize flex_container_border_box_size = CalculateBorderBoxSize(ConstraintSpace(), Node()); - NGLogicalSize flex_container_content_box_size = CalculateContentBoxSize( + NGLogicalSize flex_container_content_box_size = ShrinkAvailableSize( flex_container_border_box_size, CalculateBorderScrollbarPadding(ConstraintSpace(), Node())); LayoutUnit flex_container_border_box_inline_size =
diff --git a/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc b/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc index 56caeab..761b0b18 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc
@@ -965,17 +965,13 @@ block_content_size, border_padding)); } -NGLogicalSize CalculateContentBoxSize( - const NGLogicalSize border_box_size, - const NGBoxStrut& border_scrollbar_padding) { - NGLogicalSize size = border_box_size; - size.inline_size -= border_scrollbar_padding.InlineSum(); +NGLogicalSize ShrinkAvailableSize(NGLogicalSize size, const NGBoxStrut& inset) { + DCHECK_NE(size.inline_size, NGSizeIndefinite); + size.inline_size -= inset.InlineSum(); size.inline_size = std::max(size.inline_size, LayoutUnit()); - // Our calculated block-axis size may still be indefinite. If so, just leave - // the size as NGSizeIndefinite instead of subtracting borders and padding. if (size.block_size != NGSizeIndefinite) { - size.block_size -= border_scrollbar_padding.BlockSum(); + size.block_size -= inset.BlockSum(); size.block_size = std::max(size.block_size, LayoutUnit()); } @@ -1073,7 +1069,7 @@ } NGLogicalSize child_percentage_size = - CalculateContentBoxSize(border_box_size, border_scrollbar_padding); + ShrinkAvailableSize(border_box_size, border_scrollbar_padding); return AdjustChildPercentageSizeForQuirksAndFlex( space, node, child_percentage_size,
diff --git a/third_party/blink/renderer/core/layout/ng/ng_length_utils.h b/third_party/blink/renderer/core/layout/ng/ng_length_utils.h index f7bcf8d..71c02828 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_length_utils.h +++ b/third_party/blink/renderer/core/layout/ng/ng_length_utils.h
@@ -253,9 +253,10 @@ LayoutUnit block_content_size = NGSizeIndefinite, const base::Optional<NGBoxStrut>& border_padding = base::nullopt); -NGLogicalSize CalculateContentBoxSize( - const NGLogicalSize border_box_size, - const NGBoxStrut& border_scrollbar_padding); +// Shrink and return the available size by an inset. This may e.g. be used to +// convert from border-box to content-box size. Indefinite block size is +// allowed, in which case the inset will be ignored for block size. +NGLogicalSize ShrinkAvailableSize(NGLogicalSize size, const NGBoxStrut& inset); // Calculates the percentage resolution size that children of the node should // use.
diff --git a/third_party/blink/renderer/core/layout/ng/ng_page_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_page_layout_algorithm.cc index 9c9662a..af5b9fb 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_page_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_page_layout_algorithm.cc
@@ -29,7 +29,7 @@ NGLogicalSize border_box_size = CalculateBorderBoxSize(ConstraintSpace(), Node()); NGLogicalSize content_box_size = - CalculateContentBoxSize(border_box_size, border_scrollbar_padding); + ShrinkAvailableSize(border_box_size, border_scrollbar_padding); NGLogicalSize page_size = content_box_size; NGConstraintSpace child_space = CreateConstraintSpaceForPages(page_size);
diff --git a/third_party/blink/renderer/core/layout/scrollbars_test.cc b/third_party/blink/renderer/core/layout/scrollbars_test.cc index 00a1084..5ec7d21 100644 --- a/third_party/blink/renderer/core/layout/scrollbars_test.cc +++ b/third_party/blink/renderer/core/layout/scrollbars_test.cc
@@ -60,6 +60,15 @@ GetEventHandler().HandleMousePressEvent(event); } + void HandleContextMenuEvent(int x, int y) { + WebMouseEvent event( + WebInputEvent::kMouseDown, WebFloatPoint(x, y), WebFloatPoint(x, y), + WebPointerProperties::Button::kNoButton, 0, + WebInputEvent::Modifiers::kNoModifiers, CurrentTimeTicks()); + event.SetFrameScale(1); + GetEventHandler().SendContextMenuEvent(event); + } + void HandleMouseReleaseEvent(int x, int y) { WebMouseEvent event( WebInputEvent::kMouseUp, WebFloatPoint(x, y), WebFloatPoint(x, y), @@ -1047,6 +1056,58 @@ EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kNoPart); } +TEST_F(ScrollbarsTest, ContextMenuUpdatesScrollbarPressedPart) { + WebView().Resize(WebSize(200, 200)); + + SimRequest request("https://example.com/test.html", "text/html"); + LoadURL("https://example.com/test.html"); + request.Complete(R"HTML( + <!DOCTYPE html> + <style> + body { margin: 0px } + #scroller { overflow-x: auto; width: 180px; height: 100px } + #spacer { height: 300px } + ::-webkit-scrollbar { width: 8px } + ::-webkit-scrollbar-thumb { + background-color: hsla(0, 0%, 56%, 0.6) + } + </style> + <div id='scroller'> + <div id='spacer'></div> + </div> + )HTML"); + + Compositor().BeginFrame(); + + Document& document = GetDocument(); + + Element* scrollbar_div = document.getElementById("scroller"); + EXPECT_TRUE(scrollbar_div); + + ScrollableArea* scrollable_area = + ToLayoutBox(scrollbar_div->GetLayoutObject())->GetScrollableArea(); + + EXPECT_TRUE(scrollable_area->VerticalScrollbar()); + Scrollbar* scrollbar = scrollable_area->VerticalScrollbar(); + EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); + + // Mouse moved over the scrollbar. + HandleMouseMoveEvent(175, 5); + EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); + + // Press the scrollbar. + HandleMousePressEvent(175, 5); + EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kThumbPart); + + // ContextMenu while still pressed. + HandleContextMenuEvent(175, 5); + EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); + + // Mouse moved off the scrollbar. + HandleMousePressEvent(50, 5); + EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); +} + TEST_F(ScrollbarsTest, CustomScrollbarInOverlayScrollbarThemeWillNotCauseDCHECKFails) { WebView().Resize(WebSize(200, 200));
diff --git a/third_party/blink/renderer/core/loader/navigation_scheduler.cc b/third_party/blink/renderer/core/loader/navigation_scheduler.cc index 1cdedd5..3669988 100644 --- a/third_party/blink/renderer/core/loader/navigation_scheduler.cc +++ b/third_party/blink/renderer/core/loader/navigation_scheduler.cc
@@ -39,6 +39,7 @@ #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" #include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/dom/user_gesture_indicator.h" +#include "third_party/blink/renderer/core/events/current_input_event.h" #include "third_party/blink/renderer/core/fileapi/public_url_manager.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/deprecation.h" @@ -70,7 +71,8 @@ Document* origin_document, const KURL& url, bool replaces_current_item, - bool is_location_change) + bool is_location_change, + base::TimeTicks input_timestamp) : ScheduledNavigation(reason, delay, origin_document, @@ -78,7 +80,8 @@ is_location_change), url_(url), should_check_main_world_content_security_policy_( - kCheckContentSecurityPolicy) { + kCheckContentSecurityPolicy), + input_timestamp_(input_timestamp) { if (ContentSecurityPolicy::ShouldBypassMainWorld(origin_document)) { should_check_main_world_content_security_policy_ = kDoNotCheckContentSecurityPolicy; @@ -98,6 +101,9 @@ should_check_main_world_content_security_policy_); request.SetReplacesCurrentItem(ReplacesCurrentItem()); request.SetClientRedirect(ClientRedirectPolicy::kClientRedirect); + if (!input_timestamp_.is_null()) { + request.SetInputStartTime(input_timestamp_); + } if (blob_url_token_) { mojom::blink::BlobURLTokenPtr token_clone; @@ -115,6 +121,7 @@ mojom::blink::BlobURLTokenPtr blob_url_token_; ContentSecurityPolicyDisposition should_check_main_world_content_security_policy_; + base::TimeTicks input_timestamp_; }; class ScheduledRedirect final : public ScheduledURLNavigation { @@ -172,7 +179,8 @@ origin_document, url, replaces_current_item, - false) { + false, + base::TimeTicks()) { ClearUserGesture(); } }; @@ -181,21 +189,24 @@ public: static ScheduledFrameNavigation* Create(Document* origin_document, const KURL& url, - bool replaces_current_item) { + bool replaces_current_item, + base::TimeTicks input_timestamp) { return new ScheduledFrameNavigation(origin_document, url, - replaces_current_item); + replaces_current_item, input_timestamp); } private: ScheduledFrameNavigation(Document* origin_document, const KURL& url, - bool replaces_current_item) + bool replaces_current_item, + base::TimeTicks input_timestamp) : ScheduledURLNavigation(Reason::kFrameNavigation, 0.0, origin_document, url, replaces_current_item, - !url.ProtocolIsJavaScript()) {} + !url.ProtocolIsJavaScript(), + input_timestamp) {} }; class ScheduledReload final : public ScheduledNavigation { @@ -391,6 +402,11 @@ if (!ShouldScheduleNavigation(url)) return; + base::TimeTicks input_timestamp; + if (const WebInputEvent* input_event = CurrentInputEvent::Get()) { + input_timestamp = input_event->TimeStamp(); + } + replaces_current_item = replaces_current_item || MustReplaceCurrentItem(frame_); @@ -404,6 +420,7 @@ EqualIgnoringFragmentIdentifier(frame_->GetDocument()->Url(), url)) { FrameLoadRequest request(origin_document, ResourceRequest(url), "_self"); request.SetReplacesCurrentItem(replaces_current_item); + request.SetInputStartTime(input_timestamp); if (replaces_current_item) request.SetClientRedirect(ClientRedirectPolicy::kClientRedirect); frame_->Loader().StartNavigation(request); @@ -411,8 +428,8 @@ } } - Schedule(ScheduledFrameNavigation::Create(origin_document, url, - replaces_current_item)); + Schedule(ScheduledFrameNavigation::Create( + origin_document, url, replaces_current_item, input_timestamp)); } void NavigationScheduler::SchedulePageBlock(Document* origin_document,
diff --git a/third_party/blink/renderer/core/messaging/blink_cloneable_message.typemap b/third_party/blink/renderer/core/messaging/blink_cloneable_message.typemap index 87b9d16..65a49cc6 100644 --- a/third_party/blink/renderer/core/messaging/blink_cloneable_message.typemap +++ b/third_party/blink/renderer/core/messaging/blink_cloneable_message.typemap
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/blink/public/mojom/messaging/message_port.mojom" +mojom = "//third_party/blink/public/mojom/messaging/cloneable_message.mojom" public_headers = [ "//third_party/blink/renderer/core/messaging/blink_cloneable_message.h" ] traits_headers = [ "//third_party/blink/renderer/core/messaging/blink_cloneable_message_struct_traits.h" ]
diff --git a/third_party/blink/renderer/core/messaging/blink_cloneable_message_struct_traits.h b/third_party/blink/renderer/core/messaging/blink_cloneable_message_struct_traits.h index d976534c..8ff4d9a 100644 --- a/third_party/blink/renderer/core/messaging/blink_cloneable_message_struct_traits.h +++ b/third_party/blink/renderer/core/messaging/blink_cloneable_message_struct_traits.h
@@ -9,7 +9,7 @@ #include "mojo/public/cpp/base/unguessable_token_mojom_traits.h" #include "mojo/public/cpp/bindings/array_traits_wtf_vector.h" #include "mojo/public/cpp/bindings/string_traits_wtf.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom-blink.h" +#include "third_party/blink/public/mojom/messaging/cloneable_message.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/messaging/blink_cloneable_message.h"
diff --git a/third_party/blink/renderer/core/messaging/blink_transferable_message.typemap b/third_party/blink/renderer/core/messaging/blink_transferable_message.typemap index e0e5567f..154339b 100644 --- a/third_party/blink/renderer/core/messaging/blink_transferable_message.typemap +++ b/third_party/blink/renderer/core/messaging/blink_transferable_message.typemap
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/blink/public/mojom/messaging/message_port.mojom" +mojom = "//third_party/blink/public/mojom/messaging/transferable_message.mojom" public_headers = [ "//third_party/blink/renderer/core/messaging/blink_transferable_message.h", ]
diff --git a/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits.cc b/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits.cc index 1b5ec721..514714c6 100644 --- a/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits.cc +++ b/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits.cc
@@ -5,7 +5,6 @@ #include "third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits.h" #include "mojo/public/cpp/base/big_buffer_mojom_traits.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom-blink.h" #include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
diff --git a/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits.h b/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits.h index 0523e811..92e8bd8 100644 --- a/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits.h +++ b/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits.h
@@ -8,7 +8,7 @@ #include "mojo/public/cpp/bindings/array_traits_wtf_vector.h" #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h" #include "third_party/blink/public/common/messaging/message_port_channel.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom-blink.h" +#include "third_party/blink/public/mojom/messaging/transferable_message.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/messaging/blink_cloneable_message_struct_traits.h"
diff --git a/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits_test.cc b/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits_test.cc index 1f31017..b1e6110 100644 --- a/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits_test.cc +++ b/third_party/blink/renderer/core/messaging/blink_transferable_message_struct_traits_test.cc
@@ -9,7 +9,7 @@ #include "mojo/public/cpp/base/big_buffer_mojom_traits.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/messaging/message_port_channel.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom-blink.h" +#include "third_party/blink/public/mojom/messaging/transferable_message.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.h" #include "third_party/blink/renderer/bindings/core/v8/v8_array_buffer.h"
diff --git a/third_party/blink/renderer/core/page/create_window.cc b/third_party/blink/renderer/core/page/create_window.cc index 0a0d8df..3af72afc 100644 --- a/third_party/blink/renderer/core/page/create_window.cc +++ b/third_party/blink/renderer/core/page/create_window.cc
@@ -33,6 +33,7 @@ #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/public/web/web_window_features.h" #include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/events/current_input_event.h" #include "third_party/blink/renderer/core/exported/web_view_impl.h" #include "third_party/blink/renderer/core/frame/ad_tracker.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" @@ -446,6 +447,9 @@ FrameLoadRequest request(calling_window.document(), ResourceRequest(completed_url)); request.GetResourceRequest().SetHasUserGesture(has_user_gesture); + if (const WebInputEvent* input_event = CurrentInputEvent::Get()) { + request.SetInputStartTime(input_event->TimeStamp()); + } new_frame->Navigate(request); } else if (!url_string.IsEmpty()) { new_frame->ScheduleNavigation(*calling_window.document(), completed_url,
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc index 9e471143..909941b0 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc
@@ -462,7 +462,8 @@ } UpdateCompositingLayersAfterScroll(); - GetLayoutBox()->DispatchFakeMouseMoveEventSoon(frame->GetEventHandler()); + GetLayoutBox()->MayUpdateHoverWhenContentUnderMouseChanged( + frame->GetEventHandler()); if (scroll_type == kUserScroll || scroll_type == kCompositorScroll) { Page* page = frame->GetPage();
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.h b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.h index 10369bc..70416fe 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.h +++ b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.h
@@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/memory/scoped_refptr.h" #include "base/optional.h" -#include "third_party/blink/public/mojom/messaging/message_port.mojom-blink.h" +#include "third_party/blink/public/mojom/messaging/transferable_message.mojom-blink.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/messaging/message_port.h" #include "third_party/blink/renderer/core/workers/global_scope_creation_params.h"
diff --git a/third_party/blink/renderer/devtools/BUILD.gn b/third_party/blink/renderer/devtools/BUILD.gn index f062224..e607430 100644 --- a/third_party/blink/renderer/devtools/BUILD.gn +++ b/third_party/blink/renderer/devtools/BUILD.gn
@@ -1105,6 +1105,7 @@ ":build_release_devtools", ":copy_embedder_scripts", ":copy_emulated_devices_images", + ":copy_htaccess", ":copy_inspector_images", ":devtools_extension_api", ":frontend_protocol_sources", @@ -1125,6 +1126,15 @@ ] } +copy("copy_htaccess") { + sources = [ + "htaccess", + ] + outputs = [ + "$resources_out_dir/.htaccess", + ] +} + copy("copy_inspector_images") { sources = devtools_image_files outputs = [
diff --git a/third_party/blink/renderer/devtools/front_end/sdk/DebuggerModel.js b/third_party/blink/renderer/devtools/front_end/sdk/DebuggerModel.js index add9a53..2da577e 100644 --- a/third_party/blink/renderer/devtools/front_end/sdk/DebuggerModel.js +++ b/third_party/blink/renderer/devtools/front_end/sdk/DebuggerModel.js
@@ -251,8 +251,11 @@ */ async setBreakpointByURL(url, lineNumber, columnNumber, condition) { // Convert file url to node-js path. - if (this.target().isNodeJS()) - url = Common.ParsedURL.urlToPlatformPath(url, Host.isWin()); + let urlRegex; + if (this.target().isNodeJS()) { + const platformPath = Common.ParsedURL.urlToPlatformPath(url, Host.isWin()); + urlRegex = `${platformPath.escapeForRegExp()}|${url.escapeForRegExp()}`; + } // Adjust column if needed. let minColumnNumber = 0; const scripts = this._scriptsBySourceURL.get(url) || []; @@ -262,8 +265,13 @@ minColumnNumber = minColumnNumber ? Math.min(minColumnNumber, script.columnOffset) : script.columnOffset; } columnNumber = Math.max(columnNumber, minColumnNumber); - const response = await this._agent.invoke_setBreakpointByUrl( - {lineNumber: lineNumber, url: url, columnNumber: columnNumber, condition: condition}); + const response = await this._agent.invoke_setBreakpointByUrl({ + lineNumber: lineNumber, + url: urlRegex ? undefined : url, + urlRegex: urlRegex, + columnNumber: columnNumber, + condition: condition + }); if (response[Protocol.Error]) return {locations: [], breakpointId: null}; let locations;
diff --git a/third_party/blink/renderer/devtools/htaccess b/third_party/blink/renderer/devtools/htaccess new file mode 100644 index 0000000..94941fa4 --- /dev/null +++ b/third_party/blink/renderer/devtools/htaccess
@@ -0,0 +1,3 @@ +# devtools tests request http[s] resources from file:// origin. Let +# the tests access the resources. +Header set Access-Control-Allow-Origin "*"
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_client.cc b/third_party/blink/renderer/modules/service_worker/service_worker_client.cc index cb30ae7b..a6c32d2b 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_client.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_client.cc
@@ -8,7 +8,6 @@ #include <memory> #include "base/memory/scoped_refptr.h" #include "services/network/public/mojom/request_context_frame_type.mojom-blink.h" -#include "third_party/blink/public/mojom/service_worker/service_worker_client.mojom-blink.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/renderer/bindings/core/v8/callback_promise_adapter.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/post_message_helper.h" @@ -22,36 +21,29 @@ namespace blink { -ServiceWorkerClient* ServiceWorkerClient::Take( - ScriptPromiseResolver*, - std::unique_ptr<WebServiceWorkerClientInfo> web_client) { - if (!web_client) - return nullptr; - - switch (web_client->client_type) { - case mojom::ServiceWorkerClientType::kWindow: - return ServiceWorkerWindowClient::Create(*web_client); - case mojom::ServiceWorkerClientType::kSharedWorker: - return ServiceWorkerClient::Create(*web_client); - case mojom::ServiceWorkerClientType::kAll: - NOTREACHED(); - return nullptr; - } - NOTREACHED(); - return nullptr; -} - ServiceWorkerClient* ServiceWorkerClient::Create( const WebServiceWorkerClientInfo& info) { return new ServiceWorkerClient(info); } +ServiceWorkerClient* ServiceWorkerClient::Create( + const mojom::blink::ServiceWorkerClientInfo& info) { + return new ServiceWorkerClient(info); +} + ServiceWorkerClient::ServiceWorkerClient(const WebServiceWorkerClientInfo& info) : uuid_(info.uuid), url_(info.url.GetString()), type_(info.client_type), frame_type_(info.frame_type) {} +ServiceWorkerClient::ServiceWorkerClient( + const mojom::blink::ServiceWorkerClientInfo& info) + : uuid_(info.client_uuid), + url_(info.url.GetString()), + type_(info.client_type), + frame_type_(info.frame_type) {} + ServiceWorkerClient::~ServiceWorkerClient() = default; String ServiceWorkerClient::type() const {
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_client.h b/third_party/blink/renderer/modules/service_worker/service_worker_client.h index 8dc4046..e6c44cb 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_client.h +++ b/third_party/blink/renderer/modules/service_worker/service_worker_client.h
@@ -6,6 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_SERVICE_WORKER_SERVICE_WORKER_CLIENT_H_ #include <memory> +#include "third_party/blink/public/mojom/service_worker/service_worker_client.mojom-blink.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_clients_info.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/modules/modules_export.h" @@ -16,19 +17,15 @@ namespace blink { class PostMessageOptions; -class ScriptPromiseResolver; class ScriptState; class MODULES_EXPORT ServiceWorkerClient : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: - // To be used by CallbackPromiseAdapter. - using WebType = std::unique_ptr<WebServiceWorkerClientInfo>; - - static ServiceWorkerClient* Take(ScriptPromiseResolver*, - std::unique_ptr<WebServiceWorkerClientInfo>); static ServiceWorkerClient* Create(const WebServiceWorkerClientInfo&); + static ServiceWorkerClient* Create( + const mojom::blink::ServiceWorkerClientInfo&); ~ServiceWorkerClient() override; @@ -48,6 +45,7 @@ protected: explicit ServiceWorkerClient(const WebServiceWorkerClientInfo&); + explicit ServiceWorkerClient(const mojom::blink::ServiceWorkerClientInfo&); String Uuid() const { return uuid_; }
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_clients.cc b/third_party/blink/renderer/modules/service_worker/service_worker_clients.cc index fb2d48a1..110d5dc 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_clients.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_clients.cc
@@ -29,28 +29,6 @@ namespace { -class ClientArray { - public: - using WebType = const WebServiceWorkerClientsInfo&; - static HeapVector<Member<ServiceWorkerClient>> Take( - ScriptPromiseResolver*, - const WebServiceWorkerClientsInfo& web_clients) { - HeapVector<Member<ServiceWorkerClient>> clients; - for (size_t i = 0; i < web_clients.clients.size(); ++i) { - const WebServiceWorkerClientInfo& client = web_clients.clients[i]; - if (client.client_type == mojom::ServiceWorkerClientType::kWindow) - clients.push_back(ServiceWorkerWindowClient::Create(client)); - else - clients.push_back(ServiceWorkerClient::Create(client)); - } - return clients; - } - - private: - DISALLOW_COPY_AND_ASSIGN(ClientArray); - ClientArray() = delete; -}; - mojom::ServiceWorkerClientType GetClientType(const String& type) { if (type == "window") return mojom::ServiceWorkerClientType::kWindow; @@ -62,45 +40,42 @@ return mojom::ServiceWorkerClientType::kWindow; } -class GetCallback : public WebServiceWorkerClientCallbacks { - public: - explicit GetCallback(ScriptPromiseResolver* resolver) : resolver_(resolver) {} - ~GetCallback() override = default; - - void OnSuccess( - std::unique_ptr<WebServiceWorkerClientInfo> web_client) override { - std::unique_ptr<WebServiceWorkerClientInfo> client = - base::WrapUnique(web_client.release()); - if (!resolver_->GetExecutionContext() || - resolver_->GetExecutionContext()->IsContextDestroyed()) - return; - if (!client) { - // Resolve the promise with undefined. - resolver_->Resolve(); - return; - } - resolver_->Resolve(ServiceWorkerClient::Take(resolver_, std::move(client))); +void DidGetClient(ScriptPromiseResolver* resolver, + mojom::blink::ServiceWorkerClientInfoPtr info) { + if (!resolver->GetExecutionContext() || + resolver->GetExecutionContext()->IsContextDestroyed()) { + return; } - void OnError(const WebServiceWorkerError& error) override { - if (!resolver_->GetExecutionContext() || - resolver_->GetExecutionContext()->IsContextDestroyed()) - return; - resolver_->Reject(ServiceWorkerError::Take(resolver_.Get(), error)); + if (!info) { + // Resolve the promise with undefined. + resolver->Resolve(); + return; } - - private: - Persistent<ScriptPromiseResolver> resolver_; - DISALLOW_COPY_AND_ASSIGN(GetCallback); -}; + ServiceWorkerClient* client; + switch (info->client_type) { + case mojom::ServiceWorkerClientType::kWindow: + client = ServiceWorkerWindowClient::Create(*info); + break; + case mojom::ServiceWorkerClientType::kSharedWorker: + client = ServiceWorkerClient::Create(*info); + break; + case mojom::ServiceWorkerClientType::kAll: + NOTREACHED(); + return; + } + resolver->Resolve(client); +} void DidClaim(ScriptPromiseResolver* resolver, mojom::blink::ServiceWorkerErrorType error, const String& error_msg) { if (!resolver->GetExecutionContext() || - resolver->GetExecutionContext()->IsContextDestroyed()) + resolver->GetExecutionContext()->IsContextDestroyed()) { return; - if (error != blink::mojom::ServiceWorkerErrorType::kNone) { + } + + if (error != mojom::blink::ServiceWorkerErrorType::kNone) { DCHECK(!error_msg.IsNull()); resolver->Reject( ServiceWorkerError::GetException(resolver, error, error_msg)); @@ -110,6 +85,23 @@ resolver->Resolve(); } +void DidGetClients(ScriptPromiseResolver* resolver, + Vector<mojom::blink::ServiceWorkerClientInfoPtr> infos) { + if (!resolver->GetExecutionContext() || + resolver->GetExecutionContext()->IsContextDestroyed()) { + return; + } + + HeapVector<Member<ServiceWorkerClient>> clients; + for (const auto& info : infos) { + if (info->client_type == mojom::blink::ServiceWorkerClientType::kWindow) + clients.push_back(ServiceWorkerWindowClient::Create(*info)); + else + clients.push_back(ServiceWorkerClient::Create(*info)); + } + resolver->Resolve(std::move(clients)); +} + } // namespace ServiceWorkerClients* ServiceWorkerClients::Create() { @@ -127,11 +119,9 @@ return ScriptPromise(); ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); - ScriptPromise promise = resolver->Promise(); - ServiceWorkerGlobalScopeClient::From(execution_context) - ->GetClient(id, std::make_unique<GetCallback>(resolver)); - return promise; + ->GetClient(id, WTF::Bind(&DidGetClient, WrapPersistent(resolver))); + return resolver->Promise(); } ScriptPromise ServiceWorkerClients::matchAll( @@ -143,16 +133,12 @@ return ScriptPromise(); ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); - ScriptPromise promise = resolver->Promise(); - ServiceWorkerGlobalScopeClient::From(execution_context) ->GetClients( mojom::blink::ServiceWorkerClientQueryOptions::New( options.includeUncontrolled(), GetClientType(options.type())), - std::make_unique< - CallbackPromiseAdapter<ClientArray, ServiceWorkerError>>( - resolver)); - return promise; + WTF::Bind(&DidGetClients, WrapPersistent(resolver))); + return resolver->Promise(); } ScriptPromise ServiceWorkerClients::claim(ScriptState* script_state) {
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc index 28444304..a036a7e 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
@@ -76,6 +76,20 @@ namespace blink { +namespace { + +void DidSkipWaiting(ScriptPromiseResolver* resolver, bool success) { + if (!resolver->GetExecutionContext() || + resolver->GetExecutionContext()->IsContextDestroyed()) + return; + // Per spec the promise returned by skipWaiting() can never reject. + if (!success) + return; + resolver->Resolve(); +} + +} // namespace + ServiceWorkerGlobalScope* ServiceWorkerGlobalScope::Create( ServiceWorkerThread* thread, std::unique_ptr<GlobalScopeCreationParams> creation_params, @@ -261,12 +275,9 @@ return ScriptPromise(); ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); - ScriptPromise promise = resolver->Promise(); - ServiceWorkerGlobalScopeClient::From(execution_context) - ->SkipWaiting( - std::make_unique<CallbackPromiseAdapter<void, void>>(resolver)); - return promise; + ->SkipWaiting(WTF::Bind(&DidSkipWaiting, WrapPersistent(resolver))); + return resolver->Promise(); } void ServiceWorkerGlobalScope::BindServiceWorkerHost(
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.cc index e492b1c..7ad323c 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.cc
@@ -63,29 +63,6 @@ return web_client_info; } -void DidGetClient( - std::unique_ptr<blink::WebServiceWorkerClientCallbacks> callbacks, - mojom::blink::ServiceWorkerClientInfoPtr client) { - std::unique_ptr<blink::WebServiceWorkerClientInfo> web_client; - if (client) { - web_client = std::make_unique<blink::WebServiceWorkerClientInfo>( - ToWebServiceWorkerClientInfo(std::move(client))); - } - callbacks->OnSuccess(std::move(web_client)); -} - -void DidGetClients( - std::unique_ptr<blink::WebServiceWorkerClientsCallbacks> callbacks, - Vector<mojom::blink::ServiceWorkerClientInfoPtr> clients) { - blink::WebServiceWorkerClientsInfo info; - blink::WebVector<blink::WebServiceWorkerClientInfo> web_clients( - clients.size()); - for (size_t i = 0; i < clients.size(); ++i) - web_clients[i] = ToWebServiceWorkerClientInfo(std::move(clients[i])); - info.clients.Swap(web_clients); - callbacks->OnSuccess(info); -} - void DidOpenWindow( std::unique_ptr<blink::WebServiceWorkerClientCallbacks> callbacks, bool success, @@ -142,36 +119,21 @@ callbacks->OnSuccess(std::move(web_client)); } -void DidSkipWaiting( - std::unique_ptr<blink::WebServiceWorkerSkipWaitingCallbacks> callbacks, - bool success) { - // OnError() should not be called here since per spec the promise returned by - // skipWaiting() can never reject. - if (!success) - return; - callbacks->OnSuccess(); -} - } // namespace ServiceWorkerGlobalScopeClient::ServiceWorkerGlobalScopeClient( WebServiceWorkerContextClient& client) : client_(client) {} -void ServiceWorkerGlobalScopeClient::GetClient( - const String& id, - std::unique_ptr<WebServiceWorkerClientCallbacks> callbacks) { - DCHECK(callbacks); - service_worker_host_->GetClient( - id, WTF::Bind(&DidGetClient, std::move(callbacks))); +void ServiceWorkerGlobalScopeClient::GetClient(const String& id, + GetClientCallback callback) { + service_worker_host_->GetClient(id, std::move(callback)); } void ServiceWorkerGlobalScopeClient::GetClients( mojom::blink::ServiceWorkerClientQueryOptionsPtr options, - std::unique_ptr<WebServiceWorkerClientsCallbacks> callbacks) { - DCHECK(callbacks); - service_worker_host_->GetClients( - std::move(options), WTF::Bind(&DidGetClients, std::move(callbacks))); + GetClientsCallback callback) { + service_worker_host_->GetClients(std::move(options), std::move(callback)); } void ServiceWorkerGlobalScopeClient::OpenWindowForClients( @@ -208,11 +170,8 @@ service_worker_host_->PostMessageToClient(client_uuid, std::move(message)); } -void ServiceWorkerGlobalScopeClient::SkipWaiting( - std::unique_ptr<WebServiceWorkerSkipWaitingCallbacks> callbacks) { - DCHECK(callbacks); - service_worker_host_->SkipWaiting( - WTF::Bind(&DidSkipWaiting, std::move(callbacks))); +void ServiceWorkerGlobalScopeClient::SkipWaiting(SkipWaitingCallback callback) { + service_worker_host_->SkipWaiting(std::move(callback)); } void ServiceWorkerGlobalScopeClient::Claim(ClaimCallback callback) {
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h index 608006a..bd01990 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h
@@ -38,7 +38,6 @@ #include "third_party/blink/public/mojom/service_worker/service_worker.mojom-blink.h" #include "third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom-blink.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_clients_info.h" -#include "third_party/blink/public/platform/modules/service_worker/web_service_worker_skip_waiting_callbacks.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_stream_handle.h" #include "third_party/blink/renderer/core/messaging/message_port.h" #include "third_party/blink/renderer/core/workers/worker_clients.h" @@ -63,16 +62,20 @@ public: using ClaimCallback = mojom::blink::ServiceWorkerHost::ClaimClientsCallback; + using SkipWaitingCallback = + mojom::blink::ServiceWorkerHost::SkipWaitingCallback; + using GetClientCallback = mojom::blink::ServiceWorkerHost::GetClientCallback; + using GetClientsCallback = + mojom::blink::ServiceWorkerHost::GetClientsCallback; static const char kSupplementName[]; explicit ServiceWorkerGlobalScopeClient(WebServiceWorkerContextClient&); // Called from ServiceWorkerClients. - void GetClient(const String&, - std::unique_ptr<WebServiceWorkerClientCallbacks>); + void GetClient(const String&, GetClientCallback); void GetClients(mojom::blink::ServiceWorkerClientQueryOptionsPtr, - std::unique_ptr<WebServiceWorkerClientsCallbacks>); + GetClientsCallback); void OpenWindowForClients(const KURL&, std::unique_ptr<WebServiceWorkerClientCallbacks>); void OpenWindowForPaymentHandler( @@ -81,7 +84,7 @@ void SetCachedMetadata(const KURL&, const char*, size_t); void ClearCachedMetadata(const KURL&); void PostMessageToClient(const String& client_uuid, BlinkTransferableMessage); - void SkipWaiting(std::unique_ptr<WebServiceWorkerSkipWaitingCallbacks>); + void SkipWaiting(SkipWaitingCallback); void Claim(ClaimCallback); void Focus(const String& client_uuid, std::unique_ptr<WebServiceWorkerClientCallbacks>);
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_window_client.cc b/third_party/blink/renderer/modules/service_worker/service_worker_window_client.cc index d3849e40..3e930b1 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_window_client.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_window_client.cc
@@ -32,12 +32,23 @@ return new ServiceWorkerWindowClient(info); } +ServiceWorkerWindowClient* ServiceWorkerWindowClient::Create( + const mojom::blink::ServiceWorkerClientInfo& info) { + return new ServiceWorkerWindowClient(info); +} + ServiceWorkerWindowClient::ServiceWorkerWindowClient( const WebServiceWorkerClientInfo& info) : ServiceWorkerClient(info), page_visibility_state_(info.page_visibility_state), is_focused_(info.is_focused) {} +ServiceWorkerWindowClient::ServiceWorkerWindowClient( + const mojom::blink::ServiceWorkerClientInfo& info) + : ServiceWorkerClient(info), + page_visibility_state_(info.page_visibility_state), + is_focused_(info.is_focused) {} + ServiceWorkerWindowClient::~ServiceWorkerWindowClient() = default; String ServiceWorkerWindowClient::visibilityState() const {
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_window_client.h b/third_party/blink/renderer/modules/service_worker/service_worker_window_client.h index 1b81d633..e2acf55c 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_window_client.h +++ b/third_party/blink/renderer/modules/service_worker/service_worker_window_client.h
@@ -30,6 +30,8 @@ std::unique_ptr<WebServiceWorkerClientInfo>); static ServiceWorkerWindowClient* Create(const WebServiceWorkerClientInfo&); + static ServiceWorkerWindowClient* Create( + const mojom::blink::ServiceWorkerClientInfo&); ~ServiceWorkerWindowClient() override; // WindowClient.idl @@ -42,6 +44,8 @@ private: explicit ServiceWorkerWindowClient(const WebServiceWorkerClientInfo&); + explicit ServiceWorkerWindowClient( + const mojom::blink::ServiceWorkerClientInfo&); mojom::PageVisibilityState page_visibility_state_; bool is_focused_;
diff --git a/third_party/blink/renderer/modules/storage/storage_namespace.cc b/third_party/blink/renderer/modules/storage/storage_namespace.cc index 617817f..42352253 100644 --- a/third_party/blink/renderer/modules/storage/storage_namespace.cc +++ b/third_party/blink/renderer/modules/storage/storage_namespace.cc
@@ -45,7 +45,8 @@ std::unique_ptr<WebStorageArea> StorageNamespace::LocalStorageArea( const SecurityOrigin* origin) { DCHECK(IsMainThread()); - static std::unique_ptr<WebStorageNamespace> local_storage_namespace = nullptr; + DEFINE_STATIC_LOCAL(std::unique_ptr<WebStorageNamespace>, + local_storage_namespace, (nullptr)); if (!local_storage_namespace) local_storage_namespace = Platform::Current()->CreateLocalStorageNamespace();
diff --git a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc index d5287d2..ab50f191 100644 --- a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc +++ b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc
@@ -51,6 +51,10 @@ if (!audio_data) return; + scoped_refptr<base::SingleThreadTaskRunner> task_runner = + context->GetExecutionContext()->GetTaskRunner( + blink::TaskType::kInternalMedia); + BackgroundScheduler::PostOnBackgroundThread( FROM_HERE, CrossThreadBind(&AsyncAudioDecoder::DecodeOnBackgroundThread, @@ -58,7 +62,8 @@ WrapCrossThreadPersistent(success_callback), WrapCrossThreadPersistent(error_callback), WrapCrossThreadPersistent(resolver), - WrapCrossThreadPersistent(context))); + WrapCrossThreadPersistent(context), + std::move(task_runner))); } void AsyncAudioDecoder::DecodeOnBackgroundThread( @@ -67,7 +72,8 @@ V8PersistentCallbackFunction<V8DecodeSuccessCallback>* success_callback, V8PersistentCallbackFunction<V8DecodeErrorCallback>* error_callback, ScriptPromiseResolver* resolver, - BaseAudioContext* context) { + BaseAudioContext* context, + scoped_refptr<base::SingleThreadTaskRunner> task_runner) { DCHECK(!IsMainThread()); scoped_refptr<AudioBus> bus = CreateBusFromInMemoryAudioFile( audio_data->Data(), audio_data->ByteLength(), false, sample_rate); @@ -80,7 +86,7 @@ // exist any more. if (context) { PostCrossThreadTask( - *Platform::Current()->MainThread()->GetTaskRunner(), FROM_HERE, + *task_runner, FROM_HERE, CrossThreadBind(&AsyncAudioDecoder::NotifyComplete, WrapCrossThreadPersistent(audio_data), WrapCrossThreadPersistent(success_callback),
diff --git a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.h b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.h index 372849b..5783e169 100644 --- a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.h +++ b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.h
@@ -32,6 +32,10 @@ #include "third_party/blink/renderer/bindings/modules/v8/v8_decode_error_callback.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_decode_success_callback.h" +namespace base { +class SingleThreadTaskRunner; +} + namespace blink { class AudioBuffer; @@ -71,7 +75,8 @@ V8PersistentCallbackFunction<V8DecodeSuccessCallback>*, V8PersistentCallbackFunction<V8DecodeErrorCallback>*, ScriptPromiseResolver*, - BaseAudioContext*); + BaseAudioContext*, + scoped_refptr<base::SingleThreadTaskRunner>); static void NotifyComplete( DOMArrayBuffer* audio_data, V8PersistentCallbackFunction<V8DecodeSuccessCallback>*,
diff --git a/third_party/blink/renderer/platform/bindings/callback_interface_base.cc b/third_party/blink/renderer/platform/bindings/callback_interface_base.cc index f57bebd..6523b79 100644 --- a/third_party/blink/renderer/platform/bindings/callback_interface_base.cc +++ b/third_party/blink/renderer/platform/bindings/callback_interface_base.cc
@@ -8,11 +8,15 @@ CallbackInterfaceBase::CallbackInterfaceBase( v8::Local<v8::Object> callback_object, + v8::Local<v8::Context> callback_object_creation_context, SingleOperationOrNot single_op_or_not) { DCHECK(!callback_object.IsEmpty()); + DCHECK(!callback_object_creation_context.IsEmpty()); + DCHECK(callback_object->CreationContext() == + callback_object_creation_context); callback_relevant_script_state_ = - ScriptState::From(callback_object->CreationContext()); + ScriptState::From(callback_object_creation_context); v8::Isolate* isolate = callback_relevant_script_state_->GetIsolate(); callback_object_.Set(isolate, callback_object);
diff --git a/third_party/blink/renderer/platform/bindings/callback_interface_base.h b/third_party/blink/renderer/platform/bindings/callback_interface_base.h index dd83a4e5..cdd141a 100644 --- a/third_party/blink/renderer/platform/bindings/callback_interface_base.h +++ b/third_party/blink/renderer/platform/bindings/callback_interface_base.h
@@ -65,6 +65,7 @@ protected: CallbackInterfaceBase(v8::Local<v8::Object> callback_object, + v8::Local<v8::Context> callback_object_creation_context, SingleOperationOrNot); // Returns true iff the callback interface is a single operation callback
diff --git a/third_party/blink/renderer/platform/bindings/parkable_string_manager.cc b/third_party/blink/renderer/platform/bindings/parkable_string_manager.cc index 7b1bf47..9b4767a 100644 --- a/third_party/blink/renderer/platform/bindings/parkable_string_manager.cc +++ b/third_party/blink/renderer/platform/bindings/parkable_string_manager.cc
@@ -20,7 +20,7 @@ ParkableStringManager& ParkableStringManager::Instance() { DCHECK(IsMainThread()); - static ParkableStringManager instance; + DEFINE_STATIC_LOCAL(ParkableStringManager, instance, ()); return instance; } @@ -32,13 +32,11 @@ if (backgrounded_) { scoped_refptr<base::SingleThreadTaskRunner> task_runner = Platform::Current()->CurrentThread()->GetTaskRunner(); - if (task_runner) { // nullptr in tests. - task_runner->PostDelayedTask( - FROM_HERE, - base::BindOnce(&ParkableStringManager::ParkAllIfRendererBackgrounded, - base::Unretained(this)), - base::TimeDelta::FromSeconds(10)); - } + task_runner->PostDelayedTask( + FROM_HERE, + base::BindOnce(&ParkableStringManager::ParkAllIfRendererBackgrounded, + base::Unretained(this)), + base::TimeDelta::FromSeconds(10)); } }
diff --git a/third_party/blink/renderer/platform/bindings/parkable_string_test.cc b/third_party/blink/renderer/platform/bindings/parkable_string_test.cc index 8f1fe94a..92053ea 100644 --- a/third_party/blink/renderer/platform/bindings/parkable_string_test.cc +++ b/third_party/blink/renderer/platform/bindings/parkable_string_test.cc
@@ -9,6 +9,7 @@ #include <vector> #include "base/test/metrics/histogram_tester.h" +#include "base/test/scoped_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { @@ -27,6 +28,8 @@ void SetUp() override { ParkableStringManager::Instance().SetRendererBackgrounded(false); } + + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(ParkableStringTest, Simple) {
diff --git a/third_party/blink/renderer/platform/blob/blob_bytes_provider_test.cc b/third_party/blink/renderer/platform/blob/blob_bytes_provider_test.cc index c591eb8..b6f890e 100644 --- a/third_party/blink/renderer/platform/blob/blob_bytes_provider_test.cc +++ b/third_party/blink/renderer/platform/blob/blob_bytes_provider_test.cc
@@ -13,6 +13,7 @@ #include "base/run_loop.h" #include "base/test/scoped_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" namespace blink { @@ -20,6 +21,8 @@ class BlobBytesProviderTest : public testing::Test { public: void SetUp() override { + Platform::SetMainThreadTaskRunnerForTesting(); + test_bytes1_.resize(128); for (size_t i = 0; i < test_bytes1_.size(); ++i) test_bytes1_[i] = i % 191; @@ -41,6 +44,11 @@ combined_bytes_.AppendVector(test_bytes3_); } + void TearDown() override { + scoped_task_environment_.RunUntilIdle(); + Platform::UnsetMainThreadTaskRunnerForTesting(); + } + std::unique_ptr<BlobBytesProvider> CreateProvider( scoped_refptr<RawData> data = nullptr) { auto result = BlobBytesProvider::CreateForTesting(
diff --git a/third_party/blink/renderer/platform/blob/blob_data_test.cc b/third_party/blink/renderer/platform/blob/blob_data_test.cc index 0d9df2b..495574b 100644 --- a/third_party/blink/renderer/platform/blob/blob_data_test.cc +++ b/third_party/blink/renderer/platform/blob/blob_data_test.cc
@@ -94,6 +94,8 @@ } void SetUp() override { + Platform::SetMainThreadTaskRunnerForTesting(); + small_test_data_.resize(1024); medium_test_data_.resize(1024 * 32); large_test_data_.resize(1024 * 512); @@ -127,6 +129,11 @@ mock_blob_registry_.registrations.clear(); } + void TearDown() override { + scoped_task_environment_.RunUntilIdle(); + Platform::UnsetMainThreadTaskRunnerForTesting(); + } + void TestCreateBlob(std::unique_ptr<BlobData> data, Vector<ExpectedElement> expected_elements) { size_t blob_size = data->length();
diff --git a/third_party/blink/renderer/platform/exported/platform.cc b/third_party/blink/renderer/platform/exported/platform.cc index f82420a..4aa9849 100644 --- a/third_party/blink/renderer/platform/exported/platform.cc +++ b/third_party/blink/renderer/platform/exported/platform.cc
@@ -39,6 +39,7 @@ #include "services/service_manager/public/cpp/interface_provider.h" #include "third_party/blink/public/platform/interface_provider.h" #include "third_party/blink/public/platform/modules/webmidi/web_midi_accessor.h" +#include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h" #include "third_party/blink/public/platform/web_canvas_capture_handler.h" #include "third_party/blink/public/platform/web_graphics_context_3d_provider.h" #include "third_party/blink/public/platform/web_image_capture_frame_grabber.h" @@ -119,31 +120,56 @@ class SimpleMainThread : public WebThread { public: - SimpleMainThread() { - // WTF is not initialized at this point, so we can't use WTF::IsMainThread() - // yet. - DCHECK(base::ThreadTaskRunnerHandle::IsSet()); - } + // We rely on base::ThreadTaskRunnerHandle for tasks posted on the main + // thread. The task runner handle may not be available on Blink's startup + // (== on SimpleMainThread's construction), because some tests like + // blink_platform_unittests do not set up a global task environment. + // In those cases, a task environment is set up on a test fixture's + // creation, and GetTaskRunner() returns the right task runner during + // a test. + // + // If GetTaskRunner() can be called from a non-main thread (including + // a worker thread running Mojo callbacks), we need to somehow get a task + // runner for the main thread. This is not possible with + // ThreadTaskRunnerHandle. We currently deal with this issue by setting + // the main thread task runner on the test startup and clearing it on + // the test tear-down. This is what SetMainThreadTaskRunnerForTesting() for. + // This function is called from Platform::SetMainThreadTaskRunnerForTesting() + // and Platform::UnsetMainThreadTaskRunnerForTesting(). bool IsCurrentThread() const override { return WTF::IsMainThread(); } // TODO(yutak): Remove the const qualifier so we don't have to use mutable. ThreadScheduler* Scheduler() const override { return &scheduler_; } scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() const override { + if (main_thread_task_runner_for_testing_) + return main_thread_task_runner_for_testing_; DCHECK(WTF::IsMainThread()); return base::ThreadTaskRunnerHandle::Get(); } + void SetMainThreadTaskRunnerForTesting( + scoped_refptr<base::SingleThreadTaskRunner> task_runner) { + main_thread_task_runner_for_testing_ = std::move(task_runner); + } + private: + bool IsSimpleMainThread() const override { return true; } + mutable scheduler::SimpleThreadScheduler scheduler_; + scoped_refptr<base::SingleThreadTaskRunner> + main_thread_task_runner_for_testing_; }; } // namespace -void Platform::Initialize(Platform* platform, WebThread* main_thread) { +void Platform::Initialize( + Platform* platform, + scheduler::WebThreadScheduler* main_thread_scheduler) { DCHECK(!g_platform); DCHECK(platform); g_platform = platform; - g_platform->main_thread_ = main_thread; + g_platform->owned_main_thread_ = main_thread_scheduler->CreateMainThread(); + g_platform->main_thread_ = g_platform->owned_main_thread_.get(); InitializeCommon(platform); } @@ -200,8 +226,35 @@ void Platform::SetCurrentPlatformForTesting(Platform* platform) { DCHECK(platform); + + // The overriding platform does not necessarily own the main thread + // (owned_main_thread_ may be null), but must have a pointer to a valid + // main thread object (which may be from the overridden platform). + // + // If the new platform's main_thread_ is null, that means we need to + // create a new main thread for it. This happens only in + // ScopedUnittestsEnvironmentSetup's constructor, which bypasses + // Platform::Initialize(). + if (!platform->main_thread_) { + platform->owned_main_thread_ = std::make_unique<SimpleMainThread>(); + platform->main_thread_ = platform->owned_main_thread_.get(); + } + g_platform = platform; - g_platform->main_thread_ = platform->CurrentThread(); +} + +void Platform::SetMainThreadTaskRunnerForTesting() { + DCHECK(WTF::IsMainThread()); + DCHECK(g_platform->main_thread_->IsSimpleMainThread()); + static_cast<SimpleMainThread*>(g_platform->main_thread_) + ->SetMainThreadTaskRunnerForTesting(base::ThreadTaskRunnerHandle::Get()); +} + +void Platform::UnsetMainThreadTaskRunnerForTesting() { + DCHECK(WTF::IsMainThread()); + DCHECK(g_platform->main_thread_->IsSimpleMainThread()); + static_cast<SimpleMainThread*>(g_platform->main_thread_) + ->SetMainThreadTaskRunnerForTesting(nullptr); } Platform* Platform::Current() { @@ -213,9 +266,8 @@ } WebThread* Platform::CurrentThread() { - // This version must be called only if the main thread is owned by Platform. - // See the comments in the header. - DCHECK(owned_main_thread_); + DCHECK(main_thread_); + DCHECK(WTF::IsMainThread()); return main_thread_; }
diff --git a/third_party/blink/renderer/platform/feature_policy/feature_policy.cc b/third_party/blink/renderer/platform/feature_policy/feature_policy.cc index cf0f8f5..97fc9a2 100644 --- a/third_party/blink/renderer/platform/feature_policy/feature_policy.cc +++ b/third_party/blink/renderer/platform/feature_policy/feature_policy.cc
@@ -287,12 +287,11 @@ } const String& GetNameForFeature(mojom::FeaturePolicyFeature feature) { - const static String empty_string; for (const auto& entry : GetDefaultFeatureNameMap()) { if (entry.value == feature) return entry.key; } - return empty_string; + return g_empty_string; } } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc index c806f7e..1ff3c28 100644 --- a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc +++ b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h" +#include "base/test/scoped_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" @@ -59,6 +60,7 @@ void TearDown() override { SharedGpuContext::ResetForTesting(); } protected: + base::test::ScopedTaskEnvironment task_environment_; MockGLES2InterfaceWithSyncTokenSupport gl_; };
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index ea2c6c58..372f1ac 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -816,6 +816,10 @@ name: "NewRemotePlaybackPipeline", }, { + name: "NoHoverAfterLayoutChange", + settable_from_internals: true, + }, + { name: "NoIdleEncodingForLayoutTests", status: "test", },
diff --git a/third_party/blink/renderer/platform/scheduler/common/simple_thread_scheduler.cc b/third_party/blink/renderer/platform/scheduler/common/simple_thread_scheduler.cc index 426d1e4..7c88d23 100644 --- a/third_party/blink/renderer/platform/scheduler/common/simple_thread_scheduler.cc +++ b/third_party/blink/renderer/platform/scheduler/common/simple_thread_scheduler.cc
@@ -27,19 +27,11 @@ void SimpleThreadScheduler::PostIdleTask(const base::Location& location, WebThread::IdleTask task) { - base::TimeTicks deadline = - base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1); - base::ThreadTaskRunnerHandle::Get()->PostTask( - location, WTF::Bind(std::move(task), deadline)); } void SimpleThreadScheduler::PostNonNestableIdleTask( const base::Location& location, WebThread::IdleTask task) { - base::TimeTicks deadline = - base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1); - base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( - location, WTF::Bind(std::move(task), deadline)); } void SimpleThreadScheduler::AddRAILModeObserver(WebRAILModeObserver* observer) {
diff --git a/third_party/blink/renderer/platform/scheduler/common/simple_thread_scheduler.h b/third_party/blink/renderer/platform/scheduler/common/simple_thread_scheduler.h index b6c83d5..6f64823 100644 --- a/third_party/blink/renderer/platform/scheduler/common/simple_thread_scheduler.h +++ b/third_party/blink/renderer/platform/scheduler/common/simple_thread_scheduler.h
@@ -35,7 +35,7 @@ // Always return false. bool CanExceedIdleDeadlineIfRequired() const override; - // Post the task to the thread task runner with the time limit of 1 second. + // Those tasks are simply ignored (we assume there's no idle period). void PostIdleTask(const base::Location&, WebThread::IdleTask) override; void PostNonNestableIdleTask(const base::Location&, WebThread::IdleTask) override;
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc index 90feea59..87af6ac1 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc
@@ -493,6 +493,8 @@ return frame_task_queue_controller_->LoadingTaskQueue(); case TaskType::kNetworkingControl: return frame_task_queue_controller_->LoadingControlTaskQueue(); + case TaskType::kInternalInspector: + return frame_task_queue_controller_->InspectorTaskQueue(); default: // Non-loading task queue. DCHECK_LT(static_cast<size_t>(type),
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.cc index d0689f8..af60f2d 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.cc
@@ -53,6 +53,18 @@ } scoped_refptr<MainThreadTaskQueue> +FrameTaskQueueController::InspectorTaskQueue() { + if (!inspector_task_queue_) { + inspector_task_queue_ = main_thread_scheduler_impl_->NewTaskQueue( + MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::kDefault) + .SetFrameScheduler(frame_scheduler_impl_)); + TaskQueueCreated(inspector_task_queue_); + } + return inspector_task_queue_; +} + +scoped_refptr<MainThreadTaskQueue> FrameTaskQueueController::NonLoadingTaskQueue( MainThreadTaskQueue::QueueTraits queue_traits) { if (!non_loading_task_queues_.Contains(queue_traits.Key()))
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.h b/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.h index 1ec57ba..7d7a81d 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.h
@@ -69,6 +69,9 @@ // Return the loading control task queue and create it if it doesn't exist. scoped_refptr<MainThreadTaskQueue> LoadingControlTaskQueue(); + // Return the inspector task queue and create it if it doesn't exist. + scoped_refptr<MainThreadTaskQueue> InspectorTaskQueue(); + // Return the non-loading task queue associated with the given queue traits, // and created it if it doesn't exist. scoped_refptr<MainThreadTaskQueue> NonLoadingTaskQueue( @@ -122,6 +125,10 @@ scoped_refptr<MainThreadTaskQueue> loading_task_queue_; scoped_refptr<MainThreadTaskQueue> loading_control_task_queue_; + // Keep the inspector queue separately. It needs to mimic the IPC task queue + // behavior as far as virtual time is concerned. + scoped_refptr<MainThreadTaskQueue> inspector_task_queue_; + using NonLoadingTaskQueueMap = WTF::HashMap<MainThreadTaskQueue::QueueTraitsKeyType, scoped_refptr<MainThreadTaskQueue>>;
diff --git a/third_party/blink/renderer/platform/testing/testing_platform_support.cc b/third_party/blink/renderer/platform/testing/testing_platform_support.cc index 2017a8c..e7ed1644 100644 --- a/third_party/blink/renderer/platform/testing/testing_platform_support.cc +++ b/third_party/blink/renderer/platform/testing/testing_platform_support.cc
@@ -92,20 +92,12 @@ TestingPlatformSupport::ScopedOverrideMojoInterface:: ~ScopedOverrideMojoInterface() = default; -namespace { - -class DummyThread final : public blink::WebThread { - public: - bool IsCurrentThread() const override { return true; } - blink::ThreadScheduler* Scheduler() const override { return nullptr; } -}; - -} // namespace - TestingPlatformSupport::TestingPlatformSupport() : old_platform_(Platform::Current()), interface_provider_(new TestingInterfaceProvider) { DCHECK(old_platform_); + DCHECK(WTF::IsMainThread()); + main_thread_ = old_platform_->CurrentThread(); } TestingPlatformSupport::~TestingPlatformSupport() { @@ -158,17 +150,6 @@ is_threaded_animation_enabled_ = enabled; } -class ScopedUnittestsEnvironmentSetup::DummyPlatform final - : public blink::Platform { - public: - DummyPlatform() = default; - - blink::WebThread* CurrentThread() override { - static DummyThread dummy_thread; - return &dummy_thread; - }; -}; - class ScopedUnittestsEnvironmentSetup::DummyRendererResourceCoordinator final : public blink::RendererResourceCoordinator {}; @@ -183,7 +164,7 @@ base::DiscardableMemoryAllocator::SetInstance( discardable_memory_allocator_.get()); - dummy_platform_ = std::make_unique<DummyPlatform>(); + dummy_platform_ = std::make_unique<Platform>(); Platform::SetCurrentPlatformForTesting(dummy_platform_.get()); WTF::Partitions::Initialize(nullptr);
diff --git a/third_party/blink/renderer/platform/testing/testing_platform_support.h b/third_party/blink/renderer/platform/testing/testing_platform_support.h index fb45b23..0c3b42b 100644 --- a/third_party/blink/renderer/platform/testing/testing_platform_support.h +++ b/third_party/blink/renderer/platform/testing/testing_platform_support.h
@@ -162,11 +162,10 @@ ~ScopedUnittestsEnvironmentSetup(); private: - class DummyPlatform; class DummyRendererResourceCoordinator; std::unique_ptr<base::TestDiscardableMemoryAllocator> discardable_memory_allocator_; - std::unique_ptr<DummyPlatform> dummy_platform_; + std::unique_ptr<Platform> dummy_platform_; std::unique_ptr<DummyRendererResourceCoordinator> dummy_renderer_resource_coordinator_; std::unique_ptr<TestingPlatformSupport> testing_platform_support_;
diff --git a/third_party/closure_compiler/README.chromium b/third_party/closure_compiler/README.chromium index 698729d2..a9a6cfc 100644 --- a/third_party/closure_compiler/README.chromium +++ b/third_party/closure_compiler/README.chromium
@@ -22,3 +22,4 @@ - Cache dependency subtrees in js_binary.py for a huge performance boost. - Add js_unit_tests.gni for generating .html files for running unit tests. - Forward target visibility in the js_library template. +- Forward closure_flags in js_type_check and js_unit_tests templates.
diff --git a/third_party/closure_compiler/compile_js.gni b/third_party/closure_compiler/compile_js.gni index 5a1e581..b27a8ab 100644 --- a/third_party/closure_compiler/compile_js.gni +++ b/third_party/closure_compiler/compile_js.gni
@@ -233,7 +233,11 @@ js_binary(target_name) { sources = [] checks_only = true - forward_variables_from(invoker, [ "deps" ]) + forward_variables_from(invoker, + [ + "deps", + "closure_flags", + ]) } } else { not_needed(invoker, "*")
diff --git a/third_party/closure_compiler/js_unit_tests.gni b/third_party/closure_compiler/js_unit_tests.gni index 2d789fa..c432b63 100644 --- a/third_party/closure_compiler/js_unit_tests.gni +++ b/third_party/closure_compiler/js_unit_tests.gni
@@ -71,6 +71,7 @@ type_check_target_name = target_name + "_" + dep + "_type_check" type_check_deps += [ ":$type_check_target_name" ] js_type_check(type_check_target_name) { + forward_variables_from(invoker, [ "closure_flags" ]) deps = [ dep, ]
diff --git a/tools/cygprofile/orderfile_generator_backend.py b/tools/cygprofile/orderfile_generator_backend.py index c4af0b4a..b043fce 100755 --- a/tools/cygprofile/orderfile_generator_backend.py +++ b/tools/cygprofile/orderfile_generator_backend.py
@@ -239,10 +239,12 @@ self._system_health_profiling = system_health_profiling if monochrome: self._apk = 'Monochrome.apk' + self._apk_target = 'monochrome_apk' self._libname = 'libmonochrome' self._libchrome_target = 'monochrome' else: self._apk = 'Chrome.apk' + self._apk_target = 'chrome_apk' self._libname = 'libchrome' self._libchrome_target = 'libchrome' @@ -299,7 +301,7 @@ """ if force_relink: self._step_recorder.RunCommand(['rm', '-rf', self.lib_chrome_so]) - self.Build(instrumented, 'chrome_apk') + self.Build(instrumented, self._apk_target) def CompileLibchrome(self, instrumented, force_relink=False): """Builds a libchrome.so either with or without order_profiling on. @@ -552,6 +554,7 @@ orderfile.write('\n'.join(ordered_symbols)) def _CollectLegacyProfile(self): + files = [] try: files = self._profiler.CollectProfile( self._compiler.chrome_apk, @@ -812,10 +815,11 @@ '--use-goma', action='store_true', help='Enable GOMA.', default=False) parser.add_argument('--adb-path', help='Path to the adb binary.') - parser.add_argument('--system-health-orderfile', action='store_true', - help=('Create an orderfile based on system health ' - 'benchmarks.'), - default=False) + parser.add_argument('--no-system-health-orderfile', action='store_false', + dest='system_health_orderfile', default=True, + help=('Create an orderfile based on an about:blank ' + 'startup benchmark instead of system health ' + 'benchmarks.')) parser.add_argument('--monochrome', action='store_true', help=('Compile and instrument monochrome (for post-N ' 'devices).'))
diff --git a/tools/cygprofile/profile_android_startup.py b/tools/cygprofile/profile_android_startup.py index d8437d6..49c97337 100755 --- a/tools/cygprofile/profile_android_startup.py +++ b/tools/cygprofile/profile_android_startup.py
@@ -454,12 +454,12 @@ files.extend(os.path.join(profile_dir, f) for f in os.listdir(profile_dir)) else: - files.append(root_file) + files.append(os.path.join(self._host_profile_dir, root_file)) if len(files) == 0: raise NoProfileDataError('No profile data was collected') - return [os.path.join(profile_dir, x) for x in files] + return files def AddProfileCollectionArguments(parser):
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 627afa8..fafdfb5 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -7765,6 +7765,44 @@ </int> </enum> +<enum name="ContextMenuIOSCopyImage"> + <summary> + Events of Copy Image from context menu under iOS. Enum0 is the entrance of + an image copy process; Enum1~3 are correlated and they are recorded in the + callback of fetching image data; Enum4~5 are correlated and they are + recorded in the callback of popping up waiting alert. There is no gurantee + that each callback will be invoked in the process, so enum1~3 and enum4~5 + are not necessarily corelated. But since enum5 blocks enum1 from advancing + to enum2, approximately we have enum5 = enum2 - enum1. + </summary> + <int value="0" label="Copy Image invoked"> + Recorded when Copy Image is invoked. This is the universal set. + </int> + <int value="1" label="Image data fetched"> + Recorded when image data is fetched and ready for pasting to system + pasteboard. This is a subset of "Copy Image invoked". + </int> + <int value="2" label="Try copying fetched image (copy is not canceled)"> + Recorded when image data is fetched and the copy process is not canceled, so + pasting image data to system pasteboard will be attempted. This is a subset + of "Image data fetched". + </int> + <int value="3" label="Image copied (image is valid)"> + Recorded when image data is valid and pasted to system pasteboard + successfully. This is a subset of "Try copying fetched image". + </int> + <int value="4" label="Waiting alert popped up"> + Recorded when copy does not finish in a short time, thus an alert is popped + up to let the user wait until copy finish. This is a subset of "Copy + Image invoked". + </int> + <int value="5" label="Copy Image canceled by user"> + Recorded when the alert is popped up, and user clicks the "Cancel" + button on the alert. This is a subset of "Waiting alert popped + up". + </int> +</enum> + <enum name="ContextMenuIOSGetImageDataByJsResult"> <int value="0" label="Canvas succeed"/> <int value="1" label="XMLHttpRequest succeed"/> @@ -14488,6 +14526,7 @@ <int value="480" label="PrintHeaderFooter"/> <int value="481" label="CrostiniAllowed"/> <int value="482" label="DeviceUnaffiliatedCrostiniAllowed"/> + <int value="483" label="EnterpriseHardwarePlatformAPIEnabled"/> </enum> <enum name="EnterprisePolicyInvalidations"> @@ -44981,6 +45020,11 @@ <int value="12" label="Unknown"/> </enum> +<enum name="SigninSSOWKWebViewGetAllCookiesRequest"> + <int value="0" label="Started"/> + <int value="1" label="Finished"/> +</enum> + <enum name="SigninSwitchSyncAccountSource"> <int value="0" label="Manual signout and signin"/> <int value="1" label="Sync account switcher"/> @@ -45249,6 +45293,10 @@ Errror in handling the request because either opening backend failed or URL should not be cached </int> + <int value="6" label="IncompleteEntry"> + Entries that are read before a write to that entry has finished when read + and write request interleave. + </int> </enum> <enum name="SiteIsolationMimeType">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 2b6b5eb..4c1a90f 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -14637,6 +14637,15 @@ </summary> </histogram> +<histogram name="ContextMenu.iOS.CopyImage" enum="ContextMenuIOSCopyImage" + expires_after="2019-12-11"> + <owner>mrsuyi@chromium.org</owner> + <summary> + Logged when the copying image from context menu is invoked and relevant + events happen during the copying image procedure. + </summary> +</histogram> + <histogram name="ContextMenu.iOS.GetImageDataByJsResult" enum="ContextMenuIOSGetImageDataByJsResult" expires_after="2019-12-11"> <owner>mrsuyi@chromium.org</owner> @@ -97231,6 +97240,40 @@ <summary>Track how a profile gets signed out.</summary> </histogram> +<histogram name="Signin.SSOWKWebView.GetAllCookies.CookieCount" units="cookies"> + <owner>jlebel@chromium.org</owner> + <summary> + Counts the number of cookies returned by -[WKHTTPCookieStore + getAllCookies:]. This histogram is to help to understand how many callbacks + from |getAllCookies:| can be missing. And if the number of cookies is + related in that iOS bug. See: crbug.com/880981. + </summary> +</histogram> + +<histogram name="Signin.SSOWKWebView.GetAllCookies.Duration" units="ms"> + <owner>jlebel@chromium.org</owner> + <summary> + Tracks the time it takes for -[WKHTTPCookieStore getAllCookies:] to finish + and call its callback. Note that nothing is logged is -[WKHTTPCookieStore + getAllCookies:] fails to calls its callback. This histogram is to help to + understand how many callbacks from |getAllCookies:| can be missing, related + to a bug from iOS. And if the number of cookies is related in that iOS bug. + See: crbug.com/880981. + </summary> +</histogram> + +<histogram name="Signin.SSOWKWebView.GetAllCookies.Request" + enum="SigninSSOWKWebViewGetAllCookiesRequest"> + <owner>jlebel@chromium.org</owner> + <summary> + Counts the number of times -[WKHTTPCookieStore getAllCookies:] is called and + the number of times it calls its callback. This histogram is to help to + understand how many callbacks from |getAllCookies:| can be missing, related + to a bug from iOS. And if the number of cookies is related in that iOS bug. + See: crbug.com/880981. + </summary> +</histogram> + <histogram name="Signin.SwitchSyncAccount.Source" enum="SigninSwitchSyncAccountSource"> <owner>bsazonov@chromium.org</owner> @@ -114495,6 +114538,10 @@ </histogram> <histogram name="WebCore.Animation.CSSProperties" enum="MappedCSSProperties"> + <obsolete> + This has been superseded by Blink.UseCounter.CSSProperties which does not + count multiple times per page load. See https://crbug.com/458925. + </obsolete> <owner>ajuma@chromium.org</owner> <summary> Counts the number of times each CSS property is animated. There is no limit
diff --git a/tools/perf/benchmark.csv b/tools/perf/benchmark.csv index ad3be948..5d8d407 100644 --- a/tools/perf/benchmark.csv +++ b/tools/perf/benchmark.csv
@@ -1,5 +1,5 @@ AUTOGENERATED FILE DO NOT EDIT -See //tools/perf/generate_perf_data.py to make changes +See //tools/perf/core/perf_data_generator.py to make changes Benchmark name,Individual owners,Component,Documentation,Tags angle_perftests,"jmadill@chromium.org, chrome-gpu-perf-owners@chromium.org",Internals>GPU>ANGLE,, blink_perf.accessibility,dmazzoni@chromium.org,,https://bit.ly/blink-perf-benchmarks, @@ -14,7 +14,7 @@ blink_perf.paint,wangxianzhu@chromium.org,,https://bit.ly/blink-perf-benchmarks, blink_perf.parser,"jbroman@chromium.org, yukishiino@chromium.org, haraken@chromium.org",,https://bit.ly/blink-perf-benchmarks, blink_perf.shadow_dom,hayato@chromium.org,,https://bit.ly/blink-perf-benchmarks, -blink_perf.svg,"kouhei@chromium.org, fs@opera.com",,https://bit.ly/blink-perf-benchmarks, +blink_perf.svg,"kouhei@chromium.org, fs@opera.com",Blink>SVG,https://bit.ly/blink-perf-benchmarks, components_perftests,csharrison@chromium.org,,, dromaeo,"jbroman@chromium.org, yukishiino@chromium.org, haraken@chromium.org",,, dummy_benchmark.histogram_benchmark_1,"eakuefner@chromium.org, simonhatch@chromium.org",,, @@ -42,8 +42,8 @@ power.typical_10_mobile,perezju@chromium.org,,https://bit.ly/power-benchmarks, rasterize_and_record_micro.partial_invalidation,"vmpstr@chromium.org, wkorman@chromium.org",Internals>Compositing>Rasterization,, rasterize_and_record_micro.top_25,"vmpstr@chromium.org, wkorman@chromium.org",Internals>Compositing>Rasterization,, -rendering.desktop,"sadrul@chromium.org, vmiura@chromium.org",,https://bit.ly/rendering-benchmarks,"gpu_rasterization,image_decoding,key_desktop_move,maps,required_webgl,top_real_world_desktop,tough_animation,tough_canvas,tough_compositor,tough_filters,tough_image_decode,tough_path_rendering,tough_pinch_zoom,tough_scheduling,tough_scrolling,tough_texture_upload,tough_webgl,use_fake_camera_device" -rendering.mobile,"sadrul@chromium.org, vmiura@chromium.org",,https://bit.ly/rendering-benchmarks,"fastpath,gpu_rasterization,image_decoding,key_hit_test,key_idle_power,key_noop,key_silk,maps,pathological_mobile_sites,polymer,required_webgl,simple_mobile_sites,sync_scroll,top_real_world_desktop,top_real_world_mobile,tough_animation,tough_canvas,tough_compositor,tough_filters,tough_image_decode,tough_path_rendering,tough_scheduling,tough_scrolling,tough_texture_upload,tough_webgl,use_fake_camera_device" +rendering.desktop,"sadrul@chromium.org, vmiura@chromium.org",Internals>GPU>Metrics,https://bit.ly/rendering-benchmarks,"gpu_rasterization,image_decoding,key_desktop_move,maps,required_webgl,top_real_world_desktop,tough_animation,tough_canvas,tough_compositor,tough_filters,tough_image_decode,tough_path_rendering,tough_pinch_zoom,tough_scheduling,tough_scrolling,tough_texture_upload,tough_webgl,use_fake_camera_device" +rendering.mobile,"sadrul@chromium.org, vmiura@chromium.org",Internals>GPU>Metrics,https://bit.ly/rendering-benchmarks,"fastpath,gpu_rasterization,image_decoding,key_hit_test,key_idle_power,key_noop,key_silk,maps,pathological_mobile_sites,polymer,required_webgl,simple_mobile_sites,sync_scroll,top_real_world_desktop,top_real_world_mobile,tough_animation,tough_canvas,tough_compositor,tough_filters,tough_image_decode,tough_path_rendering,tough_scheduling,tough_scrolling,tough_texture_upload,tough_webgl,use_fake_camera_device" resource_sizes,"agrieve@chromium.org, rnephew@chromium.org, perezju@chromium.org",,, sizes (linux),thestig@chromium.org,,, sizes (mac),tapted@chromium.org,,,
diff --git a/tools/perf/benchmarks/blink_perf.py b/tools/perf/benchmarks/blink_perf.py index 478b3ec..a1d2764 100644 --- a/tools/perf/benchmarks/blink_perf.py +++ b/tools/perf/benchmarks/blink_perf.py
@@ -504,6 +504,7 @@ @benchmark.Info(emails=['kouhei@chromium.org', 'fs@opera.com'], + component='Blink>SVG', documentation_url='https://bit.ly/blink-perf-benchmarks') class BlinkPerfSVG(_BlinkPerfBenchmark): subdir = 'svg'
diff --git a/tools/perf/benchmarks/loading.py b/tools/perf/benchmarks/loading.py index 9de446e..61caa2c 100644 --- a/tools/perf/benchmarks/loading.py +++ b/tools/perf/benchmarks/loading.py
@@ -18,6 +18,11 @@ options = {'pageset_repeat': 2} + def SetExtraBrowserOptions(self, options): + options.AppendExtraBrowserArgs([ + '--enable-features=TracingPerfettoBackend', + ]) + def CreateCoreTimelineBasedMeasurementOptions(self): tbm_options = timeline_based_measurement.Options() loading_metrics_category.AugmentOptionsForLoadingMetrics(tbm_options)
diff --git a/tools/perf/benchmarks/rendering.py b/tools/perf/benchmarks/rendering.py index 00837e0..e2951f2 100644 --- a/tools/perf/benchmarks/rendering.py +++ b/tools/perf/benchmarks/rendering.py
@@ -10,7 +10,8 @@ @benchmark.Info(emails=['sadrul@chromium.org', 'vmiura@chromium.org'], - documentation_url='https://bit.ly/rendering-benchmarks') + documentation_url='https://bit.ly/rendering-benchmarks', + component='Internals>GPU>Metrics') class RenderingDesktop(perf_benchmark.PerfBenchmark): test = rendering.Rendering @@ -32,7 +33,8 @@ @benchmark.Info(emails=['sadrul@chromium.org', 'vmiura@chromium.org'], - documentation_url='https://bit.ly/rendering-benchmarks') + documentation_url='https://bit.ly/rendering-benchmarks', + component='Internals>GPU>Metrics') class RenderingMobile(perf_benchmark.PerfBenchmark): test = rendering.Rendering
diff --git a/tools/perf/core/perf_benchmark.py b/tools/perf/core/perf_benchmark.py index 64fcfaf..8cb5929 100644 --- a/tools/perf/core/perf_benchmark.py +++ b/tools/perf/core/perf_benchmark.py
@@ -106,18 +106,12 @@ options.AppendExtraBrowserArgs( '--disable-gpu-process-for-dx12-vulkan-info-collection') + # TODO(crbug.com/881469): remove this once Webview support surface # synchronization. - if 'android-webview' in options.browser_type: + if options.browser_type and 'android-webview' in options.browser_type: options.AppendExtraBrowserArgs( '--disable-features=SurfaceSynchronization') - - # Switch Chrome to use Perfetto instead of TraceLog as the tracing backend, - # needed until the feature gets turned on by default everywhere. - if options.browser_type != 'reference': - options.AppendExtraBrowserArgs( - '--enable-features=TracingPerfettoBackend') - self.SetExtraBrowserOptions(options) @staticmethod
diff --git a/tools/perf/core/perf_benchmark_unittest.py b/tools/perf/core/perf_benchmark_unittest.py index d46c77d..da74b7d 100644 --- a/tools/perf/core/perf_benchmark_unittest.py +++ b/tools/perf/core/perf_benchmark_unittest.py
@@ -200,3 +200,20 @@ benchmark.CustomizeBrowserOptions(options.browser_options) self._ExpectAdTaggingProfileFiles(options.browser_options, False) + + def testAdTaggingRulesetInvalidJson(self): + self._PopulateGenFiles() + json_path = os.path.join( + self._output_dir, 'gen', 'components', 'subresource_filter', 'tools', + 'default_local_state.json') + self.assertTrue(os.path.exists(json_path)) + with open(json_path, 'w') as f: + f.write('{some invalid : json, 19') + + benchmark = perf_benchmark.PerfBenchmark() + options = options_for_unittests.GetCopy() + options.chromium_output_dir = self._output_dir + + # Should fail due to invalid JSON. + with self.assertRaises(ValueError): + benchmark.CustomizeBrowserOptions(options.browser_options)
diff --git a/tools/perf/core/perf_data_generator.py b/tools/perf/core/perf_data_generator.py index 8dd889d7..34ba265 100755 --- a/tools/perf/core/perf_data_generator.py +++ b/tools/perf/core/perf_data_generator.py
@@ -753,7 +753,7 @@ owners, and components. Requires that all benchmarks have owners. """ header_data = [['AUTOGENERATED FILE DO NOT EDIT'], - ['See //tools/perf/generate_perf_data.py to make changes'], + ['See //tools/perf/core/perf_data_generator.py to make changes'], ['Benchmark name', 'Individual owners', 'Component', 'Documentation', 'Tags'] ]
diff --git a/tools/perf/measurements/smoothness_unittest.py b/tools/perf/measurements/smoothness_unittest.py index 7702024..f65c5b8 100644 --- a/tools/perf/measurements/smoothness_unittest.py +++ b/tools/perf/measurements/smoothness_unittest.py
@@ -69,27 +69,11 @@ self.assertEquals(len(frame_times), 1) self.assertGreater(frame_times[0].GetRepresentativeNumber(), 0) - mean_frame_time = results.FindAllPageSpecificValuesNamed('mean_frame_time') - self.assertEquals(len(mean_frame_time), 1) - self.assertGreater(mean_frame_time[0].GetRepresentativeNumber(), 0) - - frame_time_discrepancy = results.FindAllPageSpecificValuesNamed( - 'frame_time_discrepancy') - self.assertEquals(len(frame_time_discrepancy), 1) - self.assertGreater(frame_time_discrepancy[0].GetRepresentativeNumber(), 0) - percentage_smooth = results.FindAllPageSpecificValuesNamed( 'percentage_smooth') self.assertEquals(len(percentage_smooth), 1) self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0) - mean_input_event_latency = results.FindAllPageSpecificValuesNamed( - 'mean_input_event_latency') - if mean_input_event_latency: - self.assertEquals(len(mean_input_event_latency), 1) - self.assertGreater( - mean_input_event_latency[0].GetRepresentativeNumber(), 0) - @decorators.Enabled('android') # SurfaceFlinger is android-only def testSmoothnessSurfaceFlingerMetricsCalculated(self): ps = self.CreateStorySetFromFileInUnittestDataDir('scrollable_page.html')
diff --git a/ui/aura/mus/embed_root.cc b/ui/aura/mus/embed_root.cc index 372988ea..32fa6b5 100644 --- a/ui/aura/mus/embed_root.cc +++ b/ui/aura/mus/embed_root.cc
@@ -123,6 +123,7 @@ focus_client_ = std::make_unique<EmbeddedFocusClient>(window_tree_host->window()); window_tree_host_ = std::move(window_tree_host); + window_tree_host_->Show(); delegate_->OnEmbed(window()); }
diff --git a/ui/aura/mus/window_port_mus.cc b/ui/aura/mus/window_port_mus.cc index c3b5573..b2fdb61 100644 --- a/ui/aura/mus/window_port_mus.cc +++ b/ui/aura/mus/window_port_mus.cc
@@ -576,12 +576,10 @@ DCHECK_EQ(window_mus_type(), WindowMusType::LOCAL); DCHECK(!local_layer_tree_frame_sink_); - std::unique_ptr<cc::LayerTreeFrameSink> frame_sink; auto client_layer_tree_frame_sink = RequestLayerTreeFrameSink( nullptr, aura::Env::GetInstance()->context_factory()->GetGpuMemoryBufferManager()); local_layer_tree_frame_sink_ = client_layer_tree_frame_sink->GetWeakPtr(); - frame_sink = std::move(client_layer_tree_frame_sink); window_->SetEmbedFrameSinkId(GenerateFrameSinkIdFromServerId()); gfx::Size size_in_pixel = @@ -589,7 +587,7 @@ // Make sure |local_surface_id_| and |last_surface_size_in_pixels_| are // correct for the new created |local_layer_tree_frame_sink_|. GetOrAllocateLocalSurfaceId(size_in_pixel); - return frame_sink; + return client_layer_tree_frame_sink; } void WindowPortMus::OnEventTargetingPolicyChanged() {
diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc index 4c3ea6c..f9a2c60 100644 --- a/ui/aura/window_tree_host.cc +++ b/ui/aura/window_tree_host.cc
@@ -442,10 +442,6 @@ return dispatcher_.get(); } -void WindowTreeHost::OnDisplayAdded(const display::Display& new_display) {} - -void WindowTreeHost::OnDisplayRemoved(const display::Display& old_display) {} - void WindowTreeHost::OnDisplayMetricsChanged(const display::Display& display, uint32_t metrics) { if (metrics & DisplayObserver::DISPLAY_METRIC_COLOR_SPACE) {
diff --git a/ui/aura/window_tree_host.h b/ui/aura/window_tree_host.h index c64c374..47ba76f8 100644 --- a/ui/aura/window_tree_host.h +++ b/ui/aura/window_tree_host.h
@@ -276,8 +276,6 @@ ui::EventSink* GetEventSink() override; // display::DisplayObserver implementation. - void OnDisplayAdded(const display::Display& new_display) override; - void OnDisplayRemoved(const display::Display& old_display) override; void OnDisplayMetricsChanged(const display::Display& display, uint32_t metrics) override;
diff --git a/ui/base/ime/BUILD.gn b/ui/base/ime/BUILD.gn index 2de40bf..072e0a38 100644 --- a/ui/base/ime/BUILD.gn +++ b/ui/base/ime/BUILD.gn
@@ -232,4 +232,19 @@ if (is_mac) { libs = [ "AppKit.framework" ] } + + if (is_fuchsia) { + sources += [ + "fuchsia/input_method_keyboard_controller_fuchsia.cc", + "fuchsia/input_method_keyboard_controller_fuchsia.h", + "input_method_fuchsia.cc", + "input_method_fuchsia.h", + ] + + deps += [ + "//third_party/fuchsia-sdk:input", + "//ui/events", + "//ui/events:dom_keycode_converter", + ] + } }
diff --git a/ui/base/ime/fuchsia/input_method_keyboard_controller_fuchsia.cc b/ui/base/ime/fuchsia/input_method_keyboard_controller_fuchsia.cc new file mode 100644 index 0000000..b2f5b9fd --- /dev/null +++ b/ui/base/ime/fuchsia/input_method_keyboard_controller_fuchsia.cc
@@ -0,0 +1,96 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/ime/fuchsia/input_method_keyboard_controller_fuchsia.h" + +#include <utility> + +#include "base/fuchsia/component_context.h" +#include "base/logging.h" +#include "ui/base/ime/text_input_client.h" +#include "ui/events/base_event_utils.h" +#include "ui/events/keycodes/dom/dom_code.h" +#include "ui/events/keycodes/dom/keycode_converter.h" + +namespace ui { + +InputMethodKeyboardControllerFuchsia::InputMethodKeyboardControllerFuchsia( + InputMethodFuchsia* input_method) + : event_converter_(input_method), + ime_client_binding_(this), + ime_service_(base::fuchsia::ComponentContext::GetDefault() + ->ConnectToService<fuchsia::ui::input::ImeService>()), + ime_visibility_( + base::fuchsia::ComponentContext::GetDefault() + ->ConnectToService<fuchsia::ui::input::ImeVisibilityService>()), + input_method_(input_method) { + DCHECK(ime_service_); + DCHECK(input_method_); + + ime_service_.set_error_handler([this]() { + LOG(ERROR) << "Lost connection to IME service."; + ime_.Unbind(); + ime_client_binding_.Unbind(); + }); + + ime_visibility_.events().OnKeyboardVisibilityChanged = [this](bool visible) { + keyboard_visible_ = visible; + }; +} + +InputMethodKeyboardControllerFuchsia::~InputMethodKeyboardControllerFuchsia() = + default; + +bool InputMethodKeyboardControllerFuchsia::DisplayVirtualKeyboard() { + if (!ime_) { + // TODO(crbug.com/876934): Instantiate the IME with details about the + // current composition. + fuchsia::ui::input::TextInputState state = {}; + state.text = ""; + ime_service_->GetInputMethodEditor( + fuchsia::ui::input::KeyboardType::TEXT, + fuchsia::ui::input::InputMethodAction::UNSPECIFIED, std::move(state), + ime_client_binding_.NewBinding(), ime_.NewRequest()); + } + + if (!keyboard_visible_) { + ime_service_->ShowKeyboard(); + } + + return true; +} + +void InputMethodKeyboardControllerFuchsia::DismissVirtualKeyboard() { + if (keyboard_visible_) { + ime_service_->HideKeyboard(); + } +} + +void InputMethodKeyboardControllerFuchsia::AddObserver( + InputMethodKeyboardControllerObserver* observer) {} + +void InputMethodKeyboardControllerFuchsia::RemoveObserver( + InputMethodKeyboardControllerObserver* observer) {} + +bool InputMethodKeyboardControllerFuchsia::IsKeyboardVisible() { + return keyboard_visible_; +} + +void InputMethodKeyboardControllerFuchsia::DidUpdateState( + fuchsia::ui::input::TextInputState state, + std::unique_ptr<fuchsia::ui::input::InputEvent> input_event) { + if (input_event->is_keyboard()) + event_converter_.ProcessEvent(*input_event); +} + +void InputMethodKeyboardControllerFuchsia::OnAction( + fuchsia::ui::input::InputMethodAction action) { + // Synthesize an ENTER keypress and send it to the Window. + KeyEvent key_event(ET_KEY_PRESSED, KeyboardCode::VKEY_RETURN, + ui::DomCode::ENTER, ui::EF_NONE, ui::DomKey::ENTER, + ui::EventTimeForNow()); + input_method_->DispatchKeyEvent(&key_event); +} + +} // namespace ui
diff --git a/ui/base/ime/fuchsia/input_method_keyboard_controller_fuchsia.h b/ui/base/ime/fuchsia/input_method_keyboard_controller_fuchsia.h new file mode 100644 index 0000000..01b53ea --- /dev/null +++ b/ui/base/ime/fuchsia/input_method_keyboard_controller_fuchsia.h
@@ -0,0 +1,59 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_IME_FUCHSIA_INPUT_METHOD_KEYBOARD_CONTROLLER_FUCHSIA_H_ +#define UI_BASE_IME_FUCHSIA_INPUT_METHOD_KEYBOARD_CONTROLLER_FUCHSIA_H_ + +#include <fuchsia/ui/input/cpp/fidl.h> +#include <lib/fidl/cpp/binding.h> +#include <memory> + +#include "base/macros.h" +#include "ui/base/ime/input_method_fuchsia.h" +#include "ui/base/ime/input_method_keyboard_controller.h" +#include "ui/base/ime/ui_base_ime_export.h" +#include "ui/events/fuchsia/input_event_dispatcher.h" + +namespace ui { + +// Handles input events from the Fuchsia on-screen keyboard. +class UI_BASE_IME_EXPORT InputMethodKeyboardControllerFuchsia + : public InputMethodKeyboardController, + public fuchsia::ui::input::InputMethodEditorClient { + public: + // |input_method|: Pointer to the parent InputMethod which owns |this|. + explicit InputMethodKeyboardControllerFuchsia( + InputMethodFuchsia* input_method); + ~InputMethodKeyboardControllerFuchsia() override; + + // InputMethodKeyboardController implementation. + bool DisplayVirtualKeyboard() override; + void DismissVirtualKeyboard() override; + void AddObserver(InputMethodKeyboardControllerObserver* observer) override; + void RemoveObserver(InputMethodKeyboardControllerObserver* observer) override; + bool IsKeyboardVisible() override; + + private: + // InputMethodEditorClient implementation. + void DidUpdateState( + fuchsia::ui::input::TextInputState state, + std::unique_ptr<fuchsia::ui::input::InputEvent> input_event) override; + void OnAction(fuchsia::ui::input::InputMethodAction action) override; + + bool keyboard_visible_ = false; + InputEventDispatcher event_converter_; + fidl::Binding<fuchsia::ui::input::InputMethodEditorClient> + ime_client_binding_; + fuchsia::ui::input::ImeServicePtr ime_service_; + fuchsia::ui::input::InputMethodEditorPtr ime_; + fuchsia::ui::input::ImeVisibilityServicePtr ime_visibility_; + + InputMethodFuchsia* input_method_; + + DISALLOW_COPY_AND_ASSIGN(InputMethodKeyboardControllerFuchsia); +}; + +} // namespace ui + +#endif // UI_BASE_IME_FUCHSIA_INPUT_METHOD_KEYBOARD_CONTROLLER_FUCHSIA_H_
diff --git a/ui/base/ime/input_method_factory.cc b/ui/base/ime/input_method_factory.cc index 45546b3..5a7a623 100644 --- a/ui/base/ime/input_method_factory.cc +++ b/ui/base/ime/input_method_factory.cc
@@ -18,6 +18,8 @@ #include "ui/base/ime/input_method_win_tsf.h" #elif defined(OS_MACOSX) #include "ui/base/ime/input_method_mac.h" +#elif defined(OS_FUCHSIA) +#include "ui/base/ime/input_method_fuchsia.h" #elif defined(USE_AURA) && defined(USE_X11) #include "ui/base/ime/input_method_auralinux.h" #else @@ -62,6 +64,8 @@ return std::make_unique<InputMethodWinImm32>(delegate, widget); #elif defined(OS_MACOSX) return std::make_unique<InputMethodMac>(delegate); +#elif defined(OS_FUCHSIA) + return std::make_unique<InputMethodFuchsia>(delegate); #elif defined(USE_AURA) && defined(USE_X11) return std::make_unique<InputMethodAuraLinux>(delegate); #else
diff --git a/ui/base/ime/input_method_fuchsia.cc b/ui/base/ime/input_method_fuchsia.cc new file mode 100644 index 0000000..02ed1a98 --- /dev/null +++ b/ui/base/ime/input_method_fuchsia.cc
@@ -0,0 +1,64 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/ime/input_method_fuchsia.h" + +#include <fuchsia/ui/input/cpp/fidl.h> +#include <memory> +#include <utility> + +#include "base/fuchsia/component_context.h" +#include "ui/base/ime/fuchsia/input_method_keyboard_controller_fuchsia.h" +#include "ui/base/ime/text_input_client.h" + +namespace ui { + +InputMethodFuchsia::InputMethodFuchsia(internal::InputMethodDelegate* delegate) + : InputMethodBase(delegate) { + virtual_keyboard_controller_ = + std::make_unique<InputMethodKeyboardControllerFuchsia>(this); +} + +InputMethodFuchsia::~InputMethodFuchsia() {} + +InputMethodKeyboardController* +InputMethodFuchsia::GetInputMethodKeyboardController() { + return virtual_keyboard_controller_.get(); +} + +void InputMethodFuchsia::DispatchEvent(ui::Event* event) { + DCHECK(event->IsKeyEvent()); + DispatchKeyEvent(event->AsKeyEvent()); +} + +ui::EventDispatchDetails InputMethodFuchsia::DispatchKeyEvent( + ui::KeyEvent* event) { + DCHECK(event->type() == ET_KEY_PRESSED || event->type() == ET_KEY_RELEASED); + + // If no text input client, do nothing. + if (!GetTextInputClient()) + return DispatchKeyEventPostIME(event); + + // Insert the character. + ui::EventDispatchDetails dispatch_details = DispatchKeyEventPostIME(event); + if (!event->stopped_propagation() && !dispatch_details.dispatcher_destroyed && + event->type() == ET_KEY_PRESSED && GetTextInputClient()) { + const uint16_t ch = event->GetCharacter(); + if (ch) { + GetTextInputClient()->InsertChar(*event); + event->StopPropagation(); + } + } + return dispatch_details; +} + +void InputMethodFuchsia::OnCaretBoundsChanged(const TextInputClient* client) {} + +void InputMethodFuchsia::CancelComposition(const TextInputClient* client) {} + +bool InputMethodFuchsia::IsCandidatePopupOpen() const { + return false; +} + +} // namespace ui
diff --git a/ui/base/ime/input_method_fuchsia.h b/ui/base/ime/input_method_fuchsia.h new file mode 100644 index 0000000..0c72098 --- /dev/null +++ b/ui/base/ime/input_method_fuchsia.h
@@ -0,0 +1,49 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_IME_INPUT_METHOD_FUCHSIA_H_ +#define UI_BASE_IME_INPUT_METHOD_FUCHSIA_H_ + +#include <fuchsia/ui/input/cpp/fidl.h> +#include <memory> + +#include "base/macros.h" +#include "ui/base/ime/input_method_base.h" +#include "ui/base/ime/input_method_delegate.h" +#include "ui/base/ime/ui_base_ime_export.h" +#include "ui/events/fuchsia/input_event_dispatcher_delegate.h" +#include "ui/gfx/native_widget_types.h" + +namespace ui { + +class InputMethodKeyboardControllerFuchsia; + +// Hnadles input from physical keyboards and the IME service. +class UI_BASE_IME_EXPORT InputMethodFuchsia + : public InputMethodBase, + public InputEventDispatcherDelegate { + public: + explicit InputMethodFuchsia(internal::InputMethodDelegate* delegate); + ~InputMethodFuchsia() override; + + // InputMethodBase interface implementation. + InputMethodKeyboardController* GetInputMethodKeyboardController() override; + ui::EventDispatchDetails DispatchKeyEvent(ui::KeyEvent* event) override; + void OnCaretBoundsChanged(const TextInputClient* client) override; + void CancelComposition(const TextInputClient* client) override; + bool IsCandidatePopupOpen() const override; + + private: + // InputEventDispatcherDelegate interface implementation. + void DispatchEvent(ui::Event* event) override; + + std::unique_ptr<InputMethodKeyboardControllerFuchsia> + virtual_keyboard_controller_; + + DISALLOW_COPY_AND_ASSIGN(InputMethodFuchsia); +}; + +} // namespace ui + +#endif // UI_BASE_IME_INPUT_METHOD_FUCHSIA_H_
diff --git a/ui/compositor/test/in_process_context_provider.cc b/ui/compositor/test/in_process_context_provider.cc index ce0b4d54..3c63120 100644 --- a/ui/compositor/test/in_process_context_provider.cc +++ b/ui/compositor/test/in_process_context_provider.cc
@@ -168,6 +168,10 @@ return gr_context_->get(); } +gpu::SharedImageInterface* InProcessContextProvider::SharedImageInterface() { + return context_->GetSharedImageInterface(); +} + viz::ContextCacheController* InProcessContextProvider::CacheController() { CheckValidThreadOrLockAcquired(); return cache_controller_.get();
diff --git a/ui/compositor/test/in_process_context_provider.h b/ui/compositor/test/in_process_context_provider.h index af4d1ea..fbcc9604 100644 --- a/ui/compositor/test/in_process_context_provider.h +++ b/ui/compositor/test/in_process_context_provider.h
@@ -60,6 +60,7 @@ gpu::raster::RasterInterface* RasterInterface() override; gpu::ContextSupport* ContextSupport() override; class GrContext* GrContext() override; + gpu::SharedImageInterface* SharedImageInterface() override; viz::ContextCacheController* CacheController() override; base::Lock* GetLock() override; void AddObserver(viz::ContextLostObserver* obs) override;
diff --git a/ui/events/BUILD.gn b/ui/events/BUILD.gn index 3361550..3db5568a 100644 --- a/ui/events/BUILD.gn +++ b/ui/events/BUILD.gn
@@ -299,6 +299,15 @@ if (is_mac) { libs = [ "AppKit.framework" ] } + + if (is_fuchsia) { + sources += [ + "fuchsia/input_event_dispatcher.cc", + "fuchsia/input_event_dispatcher.h", + "fuchsia/input_event_dispatcher_delegate.h", + ] + public_deps += [ "//third_party/fuchsia-sdk:input" ] + } } jumbo_component("gesture_detection") { @@ -577,6 +586,10 @@ if (is_chromecast && !is_android) { sources += [ "chromecast/scroller_unittest.cc" ] } + + if (is_fuchsia) { + sources += [ "fuchsia/input_event_dispatcher_unittest.cc" ] + } } }
diff --git a/ui/events/fuchsia/input_event_dispatcher.cc b/ui/events/fuchsia/input_event_dispatcher.cc new file mode 100644 index 0000000..b240779e --- /dev/null +++ b/ui/events/fuchsia/input_event_dispatcher.cc
@@ -0,0 +1,194 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/events/fuchsia/input_event_dispatcher.h" + +#include <memory> + +#include "base/memory/ptr_util.h" +#include "ui/events/event.h" +#include "ui/events/fuchsia/input_event_dispatcher_delegate.h" +#include "ui/events/keycodes/dom/keycode_converter.h" +#include "ui/events/keycodes/keyboard_code_conversion.h" + +namespace ui { +namespace { + +const uint32_t kUsbHidKeyboardPage = 0x07; + +int KeyModifiersToFlags(int modifiers) { + int flags = 0; + if (modifiers & fuchsia::ui::input::kModifierShift) + flags |= EF_SHIFT_DOWN; + if (modifiers & fuchsia::ui::input::kModifierControl) + flags |= EF_CONTROL_DOWN; + if (modifiers & fuchsia::ui::input::kModifierAlt) + flags |= EF_ALT_DOWN; + // TODO(crbug.com/850697): Add AltGraph support. + return flags; +} + +} // namespace + +InputEventDispatcher::InputEventDispatcher( + InputEventDispatcherDelegate* delegate) + : delegate_(delegate) { + DCHECK(delegate_); +} + +InputEventDispatcher::~InputEventDispatcher() = default; + +bool InputEventDispatcher::ProcessEvent( + const fuchsia::ui::input::InputEvent& event) const { + switch (event.Which()) { + case fuchsia::ui::input::InputEvent::Tag::kPointer: + switch (event.pointer().type) { + case fuchsia::ui::input::PointerEventType::MOUSE: + return ProcessMouseEvent(event.pointer()); + case fuchsia::ui::input::PointerEventType::TOUCH: + return ProcessTouchEvent(event.pointer()); + case fuchsia::ui::input::PointerEventType::STYLUS: + case fuchsia::ui::input::PointerEventType::INVERTED_STYLUS: + NOTIMPLEMENTED() << "Stylus input is not yet supported."; + return false; + } + + case fuchsia::ui::input::InputEvent::Tag::kKeyboard: + return ProcessKeyboardEvent(event.keyboard()); + + case fuchsia::ui::input::InputEvent::Tag::kFocus: + case fuchsia::ui::input::InputEvent::Tag::Invalid: + return false; + } +} + +bool InputEventDispatcher::ProcessMouseEvent( + const fuchsia::ui::input::PointerEvent& event) const { + int flags = 0; + EventType event_type; + int buttons_flags = 0; + if (event.buttons & fuchsia::ui::input::kMouseButtonPrimary) { + buttons_flags |= EF_LEFT_MOUSE_BUTTON; + } + if (event.buttons & fuchsia::ui::input::kMouseButtonSecondary) { + buttons_flags |= EF_RIGHT_MOUSE_BUTTON; + } + if (event.buttons & fuchsia::ui::input::kMouseButtonTertiary) { + buttons_flags |= EF_MIDDLE_MOUSE_BUTTON; + } + + switch (event.phase) { + case fuchsia::ui::input::PointerEventPhase::DOWN: + event_type = ET_MOUSE_PRESSED; + break; + case fuchsia::ui::input::PointerEventPhase::MOVE: + event_type = flags ? ET_MOUSE_DRAGGED : ET_MOUSE_MOVED; + break; + case fuchsia::ui::input::PointerEventPhase::UP: + event_type = ET_MOUSE_RELEASED; + break; + + // Following phases are not expected for mouse events. + case fuchsia::ui::input::PointerEventPhase::HOVER: + case fuchsia::ui::input::PointerEventPhase::CANCEL: + case fuchsia::ui::input::PointerEventPhase::ADD: + case fuchsia::ui::input::PointerEventPhase::REMOVE: + NOTREACHED() << "Unexpected mouse phase " + << fidl::ToUnderlying(event.phase); + return false; + } + + ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(), + base::TimeTicks::FromZxTime(event.event_time), + buttons_flags, buttons_flags); + mouse_event.set_location_f(gfx::PointF(event.x, event.y)); + delegate_->DispatchEvent(&mouse_event); + return mouse_event.handled(); +} + +bool InputEventDispatcher::ProcessTouchEvent( + const fuchsia::ui::input::PointerEvent& event) const { + EventType event_type; + bool hovering = false; + switch (event.phase) { + case fuchsia::ui::input::PointerEventPhase::HOVER: + hovering = true; + event_type = ET_TOUCH_PRESSED; + break; + case fuchsia::ui::input::PointerEventPhase::DOWN: + event_type = ET_TOUCH_PRESSED; + break; + case fuchsia::ui::input::PointerEventPhase::MOVE: + event_type = ET_TOUCH_MOVED; + break; + case fuchsia::ui::input::PointerEventPhase::CANCEL: + event_type = ET_TOUCH_CANCELLED; + break; + case fuchsia::ui::input::PointerEventPhase::UP: + event_type = ET_TOUCH_RELEASED; + break; + case fuchsia::ui::input::PointerEventPhase::ADD: + case fuchsia::ui::input::PointerEventPhase::REMOVE: + return false; + } + + // TODO(crbug.com/876933): Add more detailed fields such as + // force/orientation/tilt once they are added to PointerEvent. + ui::PointerDetails pointer_details(ui::EventPointerType::POINTER_TYPE_TOUCH, + event.pointer_id); + + ui::TouchEvent touch_event(event_type, gfx::Point(), + base::TimeTicks::FromZxTime(event.event_time), + pointer_details); + touch_event.set_hovering(hovering); + touch_event.set_location_f(gfx::PointF(event.x, event.y)); + delegate_->DispatchEvent(&touch_event); + return touch_event.handled(); +} + +bool InputEventDispatcher::ProcessKeyboardEvent( + const fuchsia::ui::input::KeyboardEvent& event) const { + EventType event_type; + + switch (event.phase) { + case fuchsia::ui::input::KeyboardEventPhase::PRESSED: + case fuchsia::ui::input::KeyboardEventPhase::REPEAT: + event_type = ET_KEY_PRESSED; + break; + + case fuchsia::ui::input::KeyboardEventPhase::RELEASED: + event_type = ET_KEY_RELEASED; + break; + + case fuchsia::ui::input::KeyboardEventPhase::CANCELLED: + NOTIMPLEMENTED() << "Key event cancellation is not supported."; + event_type = ET_KEY_RELEASED; + break; + } + + // Currently KeyboardEvent doesn't specify HID Usage page. |hid_usage| + // field always contains values from the Keyboard page. See + // https://fuchsia.atlassian.net/browse/SCN-762 . + DomCode dom_code = KeycodeConverter::UsbKeycodeToDomCode( + (kUsbHidKeyboardPage << 16) | event.hid_usage); + DomKey dom_key; + KeyboardCode key_code; + if (!DomCodeToUsLayoutDomKey(dom_code, KeyModifiersToFlags(event.modifiers), + &dom_key, &key_code)) { + LOG(ERROR) << "DomCodeToUsLayoutDomKey() failed for usb_key: " + << event.hid_usage; + key_code = VKEY_UNKNOWN; + } + + if (event.code_point) + dom_key = DomKey::FromCharacter(event.code_point); + + ui::KeyEvent key_event(event_type, key_code, dom_code, + KeyModifiersToFlags(event.modifiers), dom_key, + base::TimeTicks::FromZxTime(event.event_time)); + delegate_->DispatchEvent(&key_event); + return key_event.handled(); +} + +} // namespace ui
diff --git a/ui/events/fuchsia/input_event_dispatcher.h b/ui/events/fuchsia/input_event_dispatcher.h new file mode 100644 index 0000000..6307773 --- /dev/null +++ b/ui/events/fuchsia/input_event_dispatcher.h
@@ -0,0 +1,44 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_EVENTS_FUCHSIA_INPUT_EVENT_DISPATCHER_H_ +#define UI_EVENTS_FUCHSIA_INPUT_EVENT_DISPATCHER_H_ + +#include <fuchsia/ui/input/cpp/fidl.h> + +#include "base/macros.h" +#include "ui/events/events_export.h" + +namespace ui { + +class InputEventDispatcherDelegate; + +// Translates Fuchsia input events to Chrome ui::Events. +class EVENTS_EXPORT InputEventDispatcher { + public: + // |delegate|: The recipient of any Chrome events that are processed from + // Fuchsia events. + explicit InputEventDispatcher(InputEventDispatcherDelegate* delegate); + ~InputEventDispatcher(); + + // Processes a Fuchsia |event| and dispatches Chrome ui::Events from it. + // |event|'s coordinates must be specified in device-independent pixels. + // + // Returns true if the event was processed. + bool ProcessEvent(const fuchsia::ui::input::InputEvent& event) const; + + private: + bool ProcessMouseEvent(const fuchsia::ui::input::PointerEvent& event) const; + bool ProcessTouchEvent(const fuchsia::ui::input::PointerEvent& event) const; + bool ProcessKeyboardEvent( + const fuchsia::ui::input::KeyboardEvent& event) const; + + InputEventDispatcherDelegate* delegate_; + + DISALLOW_COPY_AND_ASSIGN(InputEventDispatcher); +}; + +} // namespace ui + +#endif // UI_EVENTS_FUCHSIA_INPUT_EVENT_DISPATCHER_H_
diff --git a/ui/events/fuchsia/input_event_dispatcher_delegate.h b/ui/events/fuchsia/input_event_dispatcher_delegate.h new file mode 100644 index 0000000..78a70a8b --- /dev/null +++ b/ui/events/fuchsia/input_event_dispatcher_delegate.h
@@ -0,0 +1,22 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_EVENTS_FUCHSIA_INPUT_EVENT_DISPATCHER_DELEGATE_H_ +#define UI_EVENTS_FUCHSIA_INPUT_EVENT_DISPATCHER_DELEGATE_H_ + +#include "ui/events/events_export.h" + +namespace ui { + +class Event; + +// Translates Fuchsia input events to Chrome ui::Events. +class EVENTS_EXPORT InputEventDispatcherDelegate { + public: + virtual void DispatchEvent(ui::Event* event) = 0; +}; + +} // namespace ui + +#endif // UI_EVENTS_FUCHSIA_INPUT_EVENT_DISPATCHER_DELEGATE_H_
diff --git a/ui/events/fuchsia/input_event_dispatcher_unittest.cc b/ui/events/fuchsia/input_event_dispatcher_unittest.cc new file mode 100644 index 0000000..54a14b9 --- /dev/null +++ b/ui/events/fuchsia/input_event_dispatcher_unittest.cc
@@ -0,0 +1,263 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/events/fuchsia/input_event_dispatcher.h" + +#include <fuchsia/ui/input/cpp/fidl.h> +#include <memory> + +#include "base/macros.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/events/event.h" +#include "ui/events/fuchsia/input_event_dispatcher_delegate.h" +#include "ui/events/keycodes/dom/dom_key.h" + +using fuchsia::ui::input::InputEvent; +using FuchsiaKeyboardEvent = fuchsia::ui::input::KeyboardEvent; +using FuchsiaPointerEvent = fuchsia::ui::input::PointerEvent; + +namespace ui { +namespace { + +class InputEventDispatcherTest : public testing::Test, + public InputEventDispatcherDelegate { + public: + InputEventDispatcherTest() : dispatcher_(this) {} + ~InputEventDispatcherTest() override = default; + + void DispatchEvent(Event* event) override { + DCHECK(!captured_event_); + captured_event_ = Event::Clone(*event); + } + + protected: + InputEventDispatcher dispatcher_; + std::unique_ptr<ui::Event> captured_event_; + + void ResetCapturedEvent() { + DCHECK(captured_event_); + captured_event_.reset(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(InputEventDispatcherTest); +}; + +TEST_F(InputEventDispatcherTest, MouseEventButtons) { + // Left mouse button. + FuchsiaPointerEvent pointer_event; + pointer_event.x = 1; + pointer_event.y = 1; + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::DOWN; + pointer_event.buttons = fuchsia::ui::input::kMouseButtonPrimary; + pointer_event.type = fuchsia::ui::input::PointerEventType::MOUSE; + InputEvent event; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_TRUE(captured_event_->AsMouseEvent()->IsLeftMouseButton()); + ResetCapturedEvent(); + + // Right mouse button. + pointer_event.buttons = fuchsia::ui::input::kMouseButtonSecondary; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_TRUE(captured_event_->AsMouseEvent()->IsRightMouseButton()); + ResetCapturedEvent(); + + // Middle mouse button. + pointer_event.buttons = fuchsia::ui::input::kMouseButtonTertiary; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_TRUE(captured_event_->AsMouseEvent()->IsMiddleMouseButton()); + ResetCapturedEvent(); + + // Left mouse drag. + pointer_event.buttons = fuchsia::ui::input::kMouseButtonPrimary; + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::MOVE; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_MOUSE_DRAGGED, captured_event_->type()); + ResetCapturedEvent(); + + // Left mouse up. + pointer_event.buttons = fuchsia::ui::input::kMouseButtonPrimary; + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::UP; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_MOUSE_RELEASED, captured_event_->type()); +} + +TEST_F(InputEventDispatcherTest, MouseMove) { + FuchsiaPointerEvent pointer_event; + pointer_event.x = 1.5; + pointer_event.y = 2.5; + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::MOVE; + pointer_event.type = fuchsia::ui::input::PointerEventType::MOUSE; + InputEvent event; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(1.5, captured_event_->AsMouseEvent()->x()); + EXPECT_EQ(2.5, captured_event_->AsMouseEvent()->y()); +} + +TEST_F(InputEventDispatcherTest, TouchLocation) { + FuchsiaPointerEvent pointer_event; + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::DOWN; + pointer_event.type = fuchsia::ui::input::PointerEventType::TOUCH; + pointer_event.x = 1.5; + pointer_event.y = 2.5; + InputEvent event; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(1.5, captured_event_->AsTouchEvent()->x()); + EXPECT_EQ(2.5, captured_event_->AsTouchEvent()->y()); +} + +TEST_F(InputEventDispatcherTest, TouchPointerIds) { + FuchsiaPointerEvent pointer_event; + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::DOWN; + pointer_event.type = fuchsia::ui::input::PointerEventType::TOUCH; + pointer_event.pointer_id = 1; + InputEvent event; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_TOUCH_PRESSED, captured_event_->type()); + EXPECT_EQ(1, captured_event_->AsTouchEvent()->pointer_details().id); + ResetCapturedEvent(); + + pointer_event.pointer_id = 2; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_TOUCH_PRESSED, captured_event_->type()); + EXPECT_EQ(2, captured_event_->AsTouchEvent()->pointer_details().id); +} + +TEST_F(InputEventDispatcherTest, TouchPhases) { + FuchsiaPointerEvent pointer_event; + pointer_event.x = 1; + pointer_event.y = 1; + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::DOWN; + pointer_event.type = fuchsia::ui::input::PointerEventType::TOUCH; + InputEvent event; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_TOUCH_PRESSED, captured_event_->type()); + ResetCapturedEvent(); + + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::HOVER; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_TOUCH_PRESSED, captured_event_->type()); + EXPECT_TRUE(captured_event_->AsTouchEvent()->hovering()); + ResetCapturedEvent(); + + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::MOVE; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_TOUCH_MOVED, captured_event_->type()); + ResetCapturedEvent(); + + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::CANCEL; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_TOUCH_CANCELLED, captured_event_->type()); + ResetCapturedEvent(); + + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::UP; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_TOUCH_RELEASED, captured_event_->type()); + ResetCapturedEvent(); + + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::ADD; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(nullptr, captured_event_.get()); + + pointer_event.phase = fuchsia::ui::input::PointerEventPhase::REMOVE; + event.set_pointer(pointer_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(nullptr, captured_event_.get()); +} + +TEST_F(InputEventDispatcherTest, KeyPhases) { + FuchsiaKeyboardEvent key_event; + key_event.hid_usage = 4; // Corresponds to pressing "a" on a US keyboard. + key_event.phase = fuchsia::ui::input::KeyboardEventPhase::PRESSED; + + InputEvent event; + event.set_keyboard(key_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_KEY_PRESSED, captured_event_->type()); + ResetCapturedEvent(); + + key_event.phase = fuchsia::ui::input::KeyboardEventPhase::REPEAT; + event.set_keyboard(key_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_KEY_PRESSED, captured_event_->type()); + ResetCapturedEvent(); + + key_event.phase = fuchsia::ui::input::KeyboardEventPhase::RELEASED; + event.set_keyboard(key_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_KEY_RELEASED, captured_event_->type()); + ResetCapturedEvent(); + + key_event.phase = fuchsia::ui::input::KeyboardEventPhase::CANCELLED; + event.set_keyboard(key_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_KEY_RELEASED, captured_event_->type()); +} + +TEST_F(InputEventDispatcherTest, KeyModifiers) { + FuchsiaKeyboardEvent key_event; + key_event.hid_usage = 4; // Corresponds to pressing "a" on a US keyboard. + key_event.phase = fuchsia::ui::input::KeyboardEventPhase::PRESSED; + + InputEvent event; + event.set_keyboard(key_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_KEY_PRESSED, captured_event_->type()); + EXPECT_EQ('a', + DomKey(captured_event_->AsKeyEvent()->GetDomKey()).ToCharacter()); + EXPECT_EQ('a', captured_event_->AsKeyEvent()->GetCharacter()); + ResetCapturedEvent(); + + key_event.modifiers = fuchsia::ui::input::kModifierShift; + event.set_keyboard(key_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_KEY_PRESSED, captured_event_->type()); + EXPECT_EQ('A', + DomKey(captured_event_->AsKeyEvent()->GetDomKey()).ToCharacter()); + EXPECT_EQ('A', captured_event_->AsKeyEvent()->GetCharacter()); + EXPECT_TRUE(captured_event_->IsShiftDown()); + EXPECT_FALSE(captured_event_->IsControlDown()); + EXPECT_FALSE(captured_event_->IsAltDown()); + ResetCapturedEvent(); + + key_event.modifiers = + fuchsia::ui::input::kModifierShift | fuchsia::ui::input::kModifierControl; + event.set_keyboard(key_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_KEY_PRESSED, captured_event_->type()); + EXPECT_TRUE(captured_event_->IsShiftDown()); + EXPECT_TRUE(captured_event_->IsControlDown()); + EXPECT_FALSE(captured_event_->IsAltDown()); + ResetCapturedEvent(); + + key_event.modifiers = fuchsia::ui::input::kModifierShift | + fuchsia::ui::input::kModifierControl | + fuchsia::ui::input::kModifierAlt; + event.set_keyboard(key_event); + dispatcher_.ProcessEvent(event); + EXPECT_EQ(ET_KEY_PRESSED, captured_event_->type()); + EXPECT_EQ('A', + DomKey(captured_event_->AsKeyEvent()->GetDomKey()).ToCharacter()); + EXPECT_TRUE(captured_event_->IsShiftDown()); + EXPECT_TRUE(captured_event_->IsControlDown()); + EXPECT_TRUE(captured_event_->IsAltDown()); +} + +} // namespace +} // namespace ui
diff --git a/ui/file_manager/BUILD.gn b/ui/file_manager/BUILD.gn index 0b6badbb..8a645f38 100644 --- a/ui/file_manager/BUILD.gn +++ b/ui/file_manager/BUILD.gn
@@ -33,6 +33,7 @@ deps = [ "audio_player/elements:closure_compile", "audio_player/js:closure_compile", + "base/js:closure_compile", "file_manager/background/js:closure_compile", "file_manager/common/js:closure_compile", "file_manager/foreground/elements:closure_compile",
diff --git a/ui/file_manager/OWNERS b/ui/file_manager/OWNERS index 70c20fc..f74d475 100644 --- a/ui/file_manager/OWNERS +++ b/ui/file_manager/OWNERS
@@ -1,6 +1,5 @@ fukino@chromium.org joelhockey@chromium.org lucmult@chromium.org -mtomasz@chromium.org noel@chromium.org yamaguchi@chromium.org
diff --git a/ui/file_manager/audio_player/js/BUILD.gn b/ui/file_manager/audio_player/js/BUILD.gn index 2225d46..bcfcc90 100644 --- a/ui/file_manager/audio_player/js/BUILD.gn +++ b/ui/file_manager/audio_player/js/BUILD.gn
@@ -29,12 +29,12 @@ js_library("audio_player") { deps = [ - "../../file_manager/common/js:util", - "../../file_manager/foreground/js:volume_manager_wrapper", - "../../file_manager/foreground/js/metadata:content_metadata_provider", - "../../file_manager/foreground/js/metadata:metadata_model", "../elements:audio_player", "../elements:track_list", + "//ui/file_manager/base/js:filtered_volume_manager", + "//ui/file_manager/file_manager/common/js:util", + "//ui/file_manager/file_manager/foreground/js/metadata:content_metadata_provider", + "//ui/file_manager/file_manager/foreground/js/metadata:metadata_model", ] }
diff --git a/ui/file_manager/audio_player/js/audio_player.js b/ui/file_manager/audio_player/js/audio_player.js index f9c3cd6..e55d087 100644 --- a/ui/file_manager/audio_player/js/audio_player.js +++ b/ui/file_manager/audio_player/js/audio_player.js
@@ -14,7 +14,7 @@ */ function AudioPlayer(container) { this.container_ = container; - this.volumeManager_ = new VolumeManagerWrapper(AllowedPaths.ANY_PATH, false); + this.volumeManager_ = new FilteredVolumeManager(AllowedPaths.ANY_PATH, false); this.metadataModel_ = MetadataModel.create(this.volumeManager_); this.selectedEntry_ = null; this.invalidTracks_ = {};
diff --git a/ui/file_manager/audio_player/js/audio_player_scripts.js b/ui/file_manager/audio_player/js/audio_player_scripts.js index fc1dc5b..39158af 100644 --- a/ui/file_manager/audio_player/js/audio_player_scripts.js +++ b/ui/file_manager/audio_player/js/audio_player_scripts.js
@@ -26,7 +26,7 @@ // <include src="../../file_manager/common/js/file_type.js"> // <include src="../../file_manager/common/js/util.js"> // <include src="../../file_manager/common/js/volume_manager_common.js"> -// <include src="../../file_manager/foreground/js/volume_manager_wrapper.js"> +// <include src="../../base/js/filtered_volume_manager.js"> // <include src="../../file_manager/foreground/js/metadata/content_metadata_provider.js"> // <include src="../../file_manager/foreground/js/metadata/external_metadata_provider.js">
diff --git a/ui/file_manager/base/js/BUILD.gn b/ui/file_manager/base/js/BUILD.gn new file mode 100644 index 0000000..cffa6663 --- /dev/null +++ b/ui/file_manager/base/js/BUILD.gn
@@ -0,0 +1,32 @@ +# Copyright 2018 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +visibility = [ "//ui/file_manager/*" ] + +js_type_check("closure_compile") { + deps = [ + ":filtered_volume_manager", + ] +} + +js_library("filtered_volume_manager") { + deps = [ + "//ui/file_manager/externs:file_manager_private", + "//ui/file_manager/file_manager/common/js:async_util", + "//ui/file_manager/file_manager/common/js:files_app_entry_types", + "//ui/file_manager/file_manager/common/js:volume_manager_common", + "//ui/webui/resources/js:cr", + "//ui/webui/resources/js/cr:event_target", + "//ui/webui/resources/js/cr/ui:array_data_model", + ] + externs_list = [ + "//ui/file_manager/externs/background/volume_manager_factory.js", + "//ui/file_manager/externs/entry_location.js", + "//ui/file_manager/externs/volume_info.js", + "//ui/file_manager/externs/volume_info_list.js", + "//ui/file_manager/externs/volume_manager.js", + ] +}
diff --git a/ui/file_manager/file_manager/foreground/js/volume_manager_wrapper.js b/ui/file_manager/base/js/filtered_volume_manager.js similarity index 82% rename from ui/file_manager/file_manager/foreground/js/volume_manager_wrapper.js rename to ui/file_manager/base/js/filtered_volume_manager.js index 5d096da..5dbbe046a 100644 --- a/ui/file_manager/file_manager/foreground/js/volume_manager_wrapper.js +++ b/ui/file_manager/base/js/filtered_volume_manager.js
@@ -3,15 +3,15 @@ // found in the LICENSE file. /** - * Implementation of VolumeInfoList for VolumeManagerWrapper. + * Implementation of VolumeInfoList for FilteredVolumeManager. * In foreground/ we want to enforce this list to be filtered, so we forbid * adding/removing/splicing of the list. - * The inner list ownership is shared between VolumeInfoListWrapper and - * VolumeManagerWrapper to enforce these constraints. + * The inner list ownership is shared between FilteredVolumeInfoList and + * FilteredVolumeManager to enforce these constraints. * * @implements {VolumeInfoList} */ -class VolumeInfoListWrapper { +class FilteredVolumeInfoList { /** * @param {!cr.ui.ArrayDataModel} list */ @@ -33,11 +33,11 @@ } /** @override */ add(volumeInfo) { - throw new Error('VolumeInfoListWrapper.add not allowed in foreground'); + throw new Error('FilteredVolumeInfoList.add not allowed in foreground'); } /** @override */ remove(volumeInfo) { - throw new Error('VolumeInfoListWrapper.remove not allowed in foreground'); + throw new Error('FilteredVolumeInfoList.remove not allowed in foreground'); } /** @override */ item(index) { @@ -63,7 +63,7 @@ * TODO(hirono): Let all clients of the class pass the background page and * make the argument not optional. */ -function VolumeManagerWrapper(allowedPaths, writableOnly, opt_backgroundPage) { +function FilteredVolumeManager(allowedPaths, writableOnly, opt_backgroundPage) { cr.EventTarget.call(this); this.allowedPaths_ = allowedPaths; @@ -72,7 +72,7 @@ /** @private */ this.list_ = new cr.ui.ArrayDataModel([]); // Public VolumeManager.volumeInfoList property accessed by callers. - this.volumeInfoList = new VolumeInfoListWrapper(this.list_); + this.volumeInfoList = new FilteredVolumeInfoList(this.list_); this.volumeManager_ = null; this.pendingTasks_ = []; @@ -109,7 +109,7 @@ /** * Extends cr.EventTarget. */ -VolumeManagerWrapper.prototype.__proto__ = cr.EventTarget.prototype; +FilteredVolumeManager.prototype.__proto__ = cr.EventTarget.prototype; /** * Checks if a volume type is allowed. @@ -121,7 +121,7 @@ * @param {VolumeManagerCommon.VolumeType} volumeType * @return {boolean} */ -VolumeManagerWrapper.prototype.isAllowedVolumeType_ = function(volumeType) { +FilteredVolumeManager.prototype.isAllowedVolumeType_ = function(volumeType) { switch (this.allowedPaths_) { case AllowedPaths.ANY_PATH: return true; @@ -140,7 +140,7 @@ * @param {!VolumeInfo} volumeInfo * @return {boolean} */ -VolumeManagerWrapper.prototype.isAllowedVolume_ = function(volumeInfo) { +FilteredVolumeManager.prototype.isAllowedVolume_ = function(volumeInfo) { if (!this.isAllowedVolumeType_(volumeInfo.volumeType)) return false; if (this.writableOnly_ && volumeInfo.isReadOnly) @@ -153,7 +153,7 @@ * @param {VolumeManager} volumeManager The initialized VolumeManager instance. * @private */ -VolumeManagerWrapper.prototype.onReady_ = function(volumeManager) { +FilteredVolumeManager.prototype.onReady_ = function(volumeManager) { if (this.disposed_) return; @@ -168,7 +168,7 @@ VolumeManagerCommon.ARCHIVE_OPENED_EVENT_TYPE, this.onEventBound_); // Dispatch 'drive-connection-changed' to listeners, since the return value of - // VolumeManagerWrapper.getDriveConnectionState() can be changed by setting + // FilteredVolumeManager.getDriveConnectionState() can be changed by setting // this.volumeManager_. cr.dispatchSimpleEvent(this, 'drive-connection-changed'); @@ -200,7 +200,7 @@ * Disposes the instance. After the invocation of this method, any other * method should not be called. */ -VolumeManagerWrapper.prototype.dispose = function() { +FilteredVolumeManager.prototype.dispose = function() { this.disposed_ = true; if (!this.volumeManager_) @@ -219,7 +219,7 @@ * @param {!Event} event Event object sent from VolumeManager. * @private */ -VolumeManagerWrapper.prototype.onEvent_ = function(event) { +FilteredVolumeManager.prototype.onEvent_ = function(event) { switch (event.type) { case 'drive-connection-changed': if (this.isAllowedVolumeType_(VolumeManagerCommon.VolumeType.DRIVE)) @@ -241,7 +241,7 @@ * @param {Event} event Event object sent from VolumeInfoList. * @private */ -VolumeManagerWrapper.prototype.onVolumeInfoListUpdated_ = function(event) { +FilteredVolumeManager.prototype.onVolumeInfoListUpdated_ = function(event) { // Filters some volumes. var index = event.index; for (var i = 0; i < event.index; i++) { @@ -273,7 +273,7 @@ * Returns whether the VolumeManager is initialized or not. * @return {boolean} True if the VolumeManager is initialized. */ -VolumeManagerWrapper.prototype.isInitialized = function() { +FilteredVolumeManager.prototype.isInitialized = function() { return this.pendingTasks_ === null; }; @@ -283,7 +283,7 @@ * immediately. * @param {function()} callback Called on initialization completion. */ -VolumeManagerWrapper.prototype.ensureInitialized = function(callback) { +FilteredVolumeManager.prototype.ensureInitialized = function(callback) { if (!this.isInitialized()) { this.pendingTasks_.push(this.ensureInitialized.bind(this, callback)); return; @@ -296,7 +296,7 @@ * @return {VolumeManagerCommon.DriveConnectionState} Current drive connection * state. */ -VolumeManagerWrapper.prototype.getDriveConnectionState = function() { +FilteredVolumeManager.prototype.getDriveConnectionState = function() { if (!this.isAllowedVolumeType_(VolumeManagerCommon.VolumeType.DRIVE) || !this.volumeManager_) { return { @@ -309,7 +309,7 @@ }; /** @override */ -VolumeManagerWrapper.prototype.getVolumeInfo = function(entry) { +FilteredVolumeManager.prototype.getVolumeInfo = function(entry) { return this.filterDisallowedVolume_( this.volumeManager_ && this.volumeManager_.getVolumeInfo(entry)); }; @@ -319,7 +319,7 @@ * @param {VolumeManagerCommon.VolumeType} volumeType Volume type. * @return {VolumeInfo} Found volume info. */ -VolumeManagerWrapper.prototype.getCurrentProfileVolumeInfo = +FilteredVolumeManager.prototype.getCurrentProfileVolumeInfo = function(volumeType) { return this.filterDisallowedVolume_( this.volumeManager_ && @@ -330,7 +330,7 @@ * Obtains the default display root entry. * @param {function(Entry)} callback Callback passed the default display root. */ -VolumeManagerWrapper.prototype.getDefaultDisplayRoot = +FilteredVolumeManager.prototype.getDefaultDisplayRoot = function(callback) { this.ensureInitialized(function() { var defaultVolume = this.getCurrentProfileVolumeInfo( @@ -349,7 +349,7 @@ * @param {(!Entry|!FilesAppEntry)} entry File or directory entry. * @return {EntryLocation} Location information. */ -VolumeManagerWrapper.prototype.getLocationInfo = function(entry) { +FilteredVolumeManager.prototype.getLocationInfo = function(entry) { var locationInfo = this.volumeManager_ && this.volumeManager_.getLocationInfo(entry); if (!locationInfo) @@ -361,7 +361,7 @@ }; /** @override */ -VolumeManagerWrapper.prototype.findByDevicePath = function(devicePath) { +FilteredVolumeManager.prototype.findByDevicePath = function(devicePath) { for (var i = 0; i < this.volumeInfoList.length; i++) { const volumeInfo = this.volumeInfoList.item(i); if (volumeInfo.devicePath && volumeInfo.devicePath === devicePath) @@ -378,7 +378,7 @@ * @return {!Promise<!VolumeInfo>} The VolumeInfo. Will not resolve * if the volume is never mounted. */ -VolumeManagerWrapper.prototype.whenVolumeInfoReady = function(volumeId) { +FilteredVolumeManager.prototype.whenVolumeInfoReady = function(volumeId) { return new Promise(resolve => { this.volumeManager_.whenVolumeInfoReady(volumeId).then((volumeInfo) => { volumeInfo = this.filterDisallowedVolume_(volumeInfo); @@ -396,7 +396,7 @@ * @param {function(VolumeManagerCommon.VolumeError)} errorCallback Called when * an error occurs. */ -VolumeManagerWrapper.prototype.mountArchive = function( +FilteredVolumeManager.prototype.mountArchive = function( fileUrl, successCallback, errorCallback) { if (this.pendingTasks_) { this.pendingTasks_.push( @@ -414,7 +414,7 @@ * @param {function(VolumeManagerCommon.VolumeError)} errorCallback Called when * an error occurs. */ -VolumeManagerWrapper.prototype.unmount = function( +FilteredVolumeManager.prototype.unmount = function( volumeInfo, successCallback, errorCallback) { if (this.pendingTasks_) { this.pendingTasks_.push( @@ -431,7 +431,7 @@ * @return {!Promise} Fulfilled on success, otherwise rejected with an error * message. */ -VolumeManagerWrapper.prototype.configure = function(volumeInfo) { +FilteredVolumeManager.prototype.configure = function(volumeInfo) { if (this.pendingTasks_) { return new Promise(function(fulfill, reject) { this.pendingTasks_.push(function() { @@ -451,7 +451,7 @@ * the volume. * @private */ -VolumeManagerWrapper.prototype.filterDisallowedVolume_ = +FilteredVolumeManager.prototype.filterDisallowedVolume_ = function(volumeInfo) { if (volumeInfo && this.isAllowedVolume_(volumeInfo)) { return volumeInfo; @@ -459,23 +459,3 @@ return null; } }; - -/** - * Returns current state of VolumeManagerWrapper. - * @return {string} Current state of VolumeManagerWrapper. - */ -VolumeManagerWrapper.prototype.toString = function() { - var initialized = this.isInitialized(); - var volumeManager = initialized ? - this.volumeManager_ : - this.backgroundPage_.volumeManagerFactory.getInstanceForDebug(); - - var str = 'VolumeManagerWrapper\n' + - '- Initialized: ' + initialized + '\n'; - - if (!initialized) - str += '- PendingTasksCount: ' + this.pendingTasks_.length + '\n'; - - return str + '- VolumeManager:\n' + - ' ' + volumeManager.toString().replace(/\n/g, '\n '); -};
diff --git a/ui/file_manager/file_manager/background/js/volume_manager_impl.js b/ui/file_manager/file_manager/background/js/volume_manager_impl.js index eb79188..940b9cd 100644 --- a/ui/file_manager/file_manager/background/js/volume_manager_impl.js +++ b/ui/file_manager/file_manager/background/js/volume_manager_impl.js
@@ -488,10 +488,3 @@ callEach(request.errorCallbacks, this, [status]); } }; - -/** @override */ -VolumeManagerImpl.prototype.toString = function() { - return 'VolumeManager\n' + - '- MountQueue_:\n' + - ' ' + this.mountQueue_.toString().replace(/\n/g, '\n '); -};
diff --git a/ui/file_manager/file_manager/common/js/BUILD.gn b/ui/file_manager/file_manager/common/js/BUILD.gn index d333350..72772a1 100644 --- a/ui/file_manager/file_manager/common/js/BUILD.gn +++ b/ui/file_manager/file_manager/common/js/BUILD.gn
@@ -46,6 +46,10 @@ } js_library("file_type") { + deps = [ + ":files_app_entry_types", + ":volume_manager_common", + ] } js_library("importer_common") {
diff --git a/ui/file_manager/file_manager/common/js/file_type.js b/ui/file_manager/file_manager/common/js/file_type.js index 70b0d83..885f97f 100644 --- a/ui/file_manager/file_manager/common/js/file_type.js +++ b/ui/file_manager/file_manager/common/js/file_type.js
@@ -5,11 +5,24 @@ /** * Namespace object for file type utility functions. */ -var FileType = {}; +function FileType() {} + +/** + * @typedef {{ + * name: !string, + * type: !string, + * icon: !string, + * subtype: !string, + * pattern: (RegExp|undefined), + * mimePattern: (RegExp|undefined) + * }} + */ +FileType.Descriptor; /** * Description of known file types. * Pair type-subtype defines order when sorted by file type. + * @type {Array<!FileType.Descriptor>} */ FileType.types = [ // Images @@ -264,13 +277,32 @@ /** * A special type for directory. + * @type{!FileType.Descriptor} + * @const */ -FileType.DIRECTORY = {name: 'FOLDER', type: '.folder', icon: 'folder'}; +FileType.DIRECTORY = { + name: 'FOLDER', + type: '.folder', + icon: 'folder', + subtype: '' +}; + +/** + * A special placeholder for unknown types with no extension. + * @type{!FileType.Descriptor} + * @const + */ +FileType.PLACEHOLDER = { + name: 'NO_EXTENSION_FILE_TYPE', + type: 'UNKNOWN', + icon: '', + subtype: '' +}; /** * Returns the file path extension for a given file. * - * @param {Entry} entry Reference to the file. + * @param {Entry|FilesAppEntry} entry Reference to the file. * @return {string} The extension including a leading '.', or empty string if * not found. */ @@ -293,7 +325,7 @@ * if possible, since this method can't recognize directories. * * @param {string} name Name of the file. - * @return {!Object} The matching file type object or an empty object. + * @return {!FileType.Descriptor} The matching descriptor or a placeholder. */ FileType.getTypeForName = function(name) { var types = FileType.types; @@ -305,9 +337,9 @@ // Unknown file type. var match = /\.[^\/\.]+$/.exec(name); var extension = match ? match[0] : ''; - if (extension === '') { - return { name: 'NO_EXTENSION_FILE_TYPE', type: 'UNKNOWN', icon: '' }; - } + if (extension === '') + return FileType.PLACEHOLDER; + // subtype is the extension excluding the first dot. return { name: 'GENERIC_FILE_TYPE', type: 'UNKNOWN', @@ -319,9 +351,9 @@ * Gets the file type object for a given entry. If mime type is provided, then * uses it with higher priority than the extension. * - * @param {Entry} entry Reference to the entry. + * @param {(Entry|FilesAppEntry)} entry Reference to the entry. * @param {string=} opt_mimeType Optional mime type for the entry. - * @return {!Object} The matching file type object or an empty object. + * @return {!FileType.Descriptor} The matching descriptor or a placeholder. */ FileType.getType = function(entry, opt_mimeType) { if (entry.isDirectory) @@ -343,9 +375,9 @@ // Unknown file type. var extension = FileType.getExtension(entry); - if (extension === '') { - return { name: 'NO_EXTENSION_FILE_TYPE', type: 'UNKNOWN', icon: '' }; - } + if (extension === '') + return FileType.PLACEHOLDER; + // subtype is the extension excluding the first dot. return { name: 'GENERIC_FILE_TYPE', type: 'UNKNOWN', @@ -425,7 +457,7 @@ }; /** - * @param {Entry} entry Reference to the file. + * @param {Entry|VolumeEntry} entry Reference to the file. * @param {string=} opt_mimeType Optional mime type for the file. * @return {string} Returns string that represents the file icon. * It refers to a file 'images/filetype_' + icon + '.png'.
diff --git a/ui/file_manager/file_manager/common/js/metrics_base.js b/ui/file_manager/file_manager/common/js/metrics_base.js index ac920df..940d2ce 100644 --- a/ui/file_manager/file_manager/common/js/metrics_base.js +++ b/ui/file_manager/file_manager/common/js/metrics_base.js
@@ -62,7 +62,8 @@ } catch (e) { console.error(e.stack); } - if (metrics.log) + // Support writing metrics.log in manual testing to log method calls. + if (/** @type{{ log: (boolean|undefined) }} */ (metrics).log) console.log('chrome.metricsPrivate.' + methodName, args); }; @@ -141,7 +142,7 @@ var validValues = opt_validValues; if (metrics.validEnumValues_ && name in metrics.validEnumValues_) { console.assert(validValues === undefined); - validValues = metrics.validEnumValues_[name] + validValues = metrics.validEnumValues_[name]; } console.assert(validValues !== undefined);
diff --git a/ui/file_manager/file_manager/foreground/js/BUILD.gn b/ui/file_manager/file_manager/foreground/js/BUILD.gn index 84df5cb..2823093 100644 --- a/ui/file_manager/file_manager/foreground/js/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/BUILD.gn
@@ -62,7 +62,6 @@ ":task_history", ":thumbnail_loader", ":toolbar_controller", - ":volume_manager_wrapper", ":web_store_utils", ":webui_command_extender", ] @@ -260,10 +259,10 @@ ":spinner_controller", ":task_controller", ":toolbar_controller", - ":volume_manager_wrapper", "ui:commandbutton", "ui:directory_tree", "ui:file_manager_ui", + "//ui/file_manager/base/js:filtered_volume_manager", "//ui/webui/resources/js/cr/ui:list_selection_model", ] } @@ -339,11 +338,11 @@ js_library("folder_shortcuts_data_model") { deps = [ - ":volume_manager_wrapper", - "../../common/js:async_util", - "../../common/js:metrics", - "../../common/js:util", - "../../common/js:volume_manager_common", + "//ui/file_manager/base/js:filtered_volume_manager", + "//ui/file_manager/file_manager/common/js:async_util", + "//ui/file_manager/file_manager/common/js:metrics", + "//ui/file_manager/file_manager/common/js:util", + "//ui/file_manager/file_manager/common/js:volume_manager_common", ] } @@ -596,26 +595,6 @@ ] } -# TODO(tapted): Move this to //ui/file_manager/base. -js_library("volume_manager_wrapper") { - visibility += [ - "//ui/file_manager/audio_player/*", - "//ui/file_manager/gallery/*", - "//ui/file_manager/video_player/*", - ] - deps = [ - "../../common/js:async_util", - "//ui/webui/resources/js:cr", - "//ui/webui/resources/js/cr:event_target", - "//ui/webui/resources/js/cr/ui:array_data_model", - ] - externs_list = [ - "../../../externs/background/volume_manager_factory.js", - "../../../externs/volume_info_list.js", - "../../../externs/volume_manager.js", - ] -} - js_library("web_store_utils") { deps = [ ":constants",
diff --git a/ui/file_manager/file_manager/foreground/js/directory_tree_naming_controller.js b/ui/file_manager/file_manager/foreground/js/directory_tree_naming_controller.js index fb70bdd..4445321 100644 --- a/ui/file_manager/file_manager/foreground/js/directory_tree_naming_controller.js +++ b/ui/file_manager/file_manager/foreground/js/directory_tree_naming_controller.js
@@ -185,6 +185,8 @@ label.textContent = newName; this.currentDirectoryItem_.entry = newEntry; + this.currentDirectoryItem_.updateSubDirectories( + true /* recursive */); this.detach_();
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js index c9b7037..a4e36da 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -18,7 +18,7 @@ /** * Volume manager. - * @type {VolumeManagerWrapper} + * @type {FilteredVolumeManager} * @private */ this.volumeManager_ = null; @@ -466,7 +466,7 @@ return this.backgroundPage_; }, /** - * @return {VolumeManagerWrapper} + * @return {FilteredVolumeManager} */ get volumeManager() { return this.volumeManager_; @@ -905,7 +905,7 @@ var writableOnly = this.launchParams_.type === DialogType.SELECT_SAVEAS_FILE; - // VolumeManagerWrapper hides virtual file system related event and data + // FilteredVolumeManager hides virtual file system related event and data // even depends on the value of |supportVirtualPath|. If it is // VirtualPathSupport.NO_VIRTUAL_PATH, it hides Drive even if Drive is // enabled on preference. @@ -914,7 +914,7 @@ // true. // Note that the Drive enabling preference change is listened by // DriveIntegrationService, so here we don't need to take care about it. - this.volumeManager_ = new VolumeManagerWrapper( + this.volumeManager_ = new FilteredVolumeManager( allowedPaths, writableOnly, this.backgroundPage_); }; @@ -1583,17 +1583,4 @@ FileManager.prototype.getCurrentList = function() { return this.ui.listContainer.currentList; }; - - /** - * Outputs the current state for debugging. - */ - FileManager.prototype.debugMe = function() { - var out = 'Debug information.\n'; - - out += '1. VolumeManagerWrapper\n' + - this.volumeManager_.toString() + '\n'; - - out += 'End of debug information.'; - console.log(out); - }; })();
diff --git a/ui/file_manager/file_manager/foreground/js/folder_shortcuts_data_model.js b/ui/file_manager/file_manager/foreground/js/folder_shortcuts_data_model.js index ccd25e89..7928aee0 100644 --- a/ui/file_manager/file_manager/foreground/js/folder_shortcuts_data_model.js +++ b/ui/file_manager/file_manager/foreground/js/folder_shortcuts_data_model.js
@@ -13,7 +13,7 @@ * object with additional methods for the folder shortcut feature. * This uses chrome.storage as backend. Items are always sorted by URL. * - * @param {!VolumeManagerWrapper} volumeManager Volume manager instance. + * @param {!FilteredVolumeManager} volumeManager Volume manager instance. * @constructor * @extends {cr.EventTarget} */
diff --git a/ui/file_manager/file_manager/foreground/js/main_scripts.js b/ui/file_manager/file_manager/foreground/js/main_scripts.js index 3d346db..52aca2b 100644 --- a/ui/file_manager/file_manager/foreground/js/main_scripts.js +++ b/ui/file_manager/file_manager/foreground/js/main_scripts.js
@@ -187,7 +187,7 @@ // <include src="ui/search_box.js"> // <include src="ui/suggest_apps_dialog.js"> // <include src="main_window_component.js"> -// <include src="volume_manager_wrapper.js"> +// <include src="../../../base/js/filtered_volume_manager.js"> // <include src="webui_command_extender.js"> // // For accurate load performance tracking place main.js should be
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_table_list.js b/ui/file_manager/file_manager/foreground/js/ui/file_table_list.js index 9634f7e..cd015c3 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/file_table_list.js +++ b/ui/file_manager/file_manager/foreground/js/ui/file_table_list.js
@@ -205,10 +205,10 @@ filelist.updateListItemExternalProps = function( li, externalProps, isTeamDriveRoot) { if (li.classList.contains('file')) { - if (externalProps.availableOffline) - li.classList.remove('dim-offline'); - else + if (externalProps.availableOffline === false) li.classList.add('dim-offline'); + else + li.classList.remove('dim-offline'); // TODO(mtomasz): Consider adding some vidual indication for files which // are not cached on LTE. Currently we show them as normal files. // crbug.com/246611.
diff --git a/ui/file_manager/gallery/js/BUILD.gn b/ui/file_manager/gallery/js/BUILD.gn index b38e6bda..c9f8ed7 100644 --- a/ui/file_manager/gallery/js/BUILD.gn +++ b/ui/file_manager/gallery/js/BUILD.gn
@@ -78,10 +78,10 @@ ":gallery_constants", ":gallery_item", ":thumbnail_mode", - "../../file_manager/common/js:util", - "../../file_manager/foreground/js:volume_manager_wrapper", - "../../file_manager/foreground/js/ui:files_confirm_dialog", - "../../gallery/js:slide_mode", + "//ui/file_manager/base/js:filtered_volume_manager", + "//ui/file_manager/file_manager/common/js:util", + "//ui/file_manager/file_manager/foreground/js/ui:files_confirm_dialog", + "//ui/file_manager/gallery/js:slide_mode", "//ui/webui/resources/js:i18n_template_no_process", ] }
diff --git a/ui/file_manager/gallery/js/gallery.js b/ui/file_manager/gallery/js/gallery.js index ec4da89d..5cee684 100644 --- a/ui/file_manager/gallery/js/gallery.js +++ b/ui/file_manager/gallery/js/gallery.js
@@ -1018,7 +1018,7 @@ * Singleton gallery. * @type {Gallery} */ -var gallery = null; +let gallery = null; /** * (Re-)loads entries. @@ -1035,10 +1035,9 @@ * Promise to initialize the load time data. * @type {!Promise} */ -var loadTimeDataPromise = new Promise(function(fulfill, reject) { +const loadTimeDataPromise = new Promise(function(fulfill, reject) { chrome.fileManagerPrivate.getStrings(function(strings) { window.loadTimeData.data = strings; - i18nTemplate.process(document, loadTimeData); fulfill(true); }); }); @@ -1047,21 +1046,58 @@ * Promise to initialize volume manager. * @type {!Promise} */ -var volumeManagerPromise = new Promise(function(fulfill, reject) { - var volumeManager = new VolumeManagerWrapper(AllowedPaths.ANY_PATH, false); +const volumeManagerPromise = new Promise(function(fulfill, reject) { + let volumeManager = new FilteredVolumeManager(AllowedPaths.ANY_PATH, false); volumeManager.ensureInitialized(fulfill.bind(null, volumeManager)); }); /** - * Promise to initialize both the volume manager and the load time data. - * @type {!Promise} + * Promise to initialize both the volume manager and the load time data, and + * then create the gallery. + * @type {Promise} */ -var initializePromise = - Promise.all([loadTimeDataPromise, volumeManagerPromise]). - then(function(args) { - var volumeManager = args[1]; - gallery = new Gallery(volumeManager); - }); +let initializePromise = null; -// Loads entries. -initializePromise.then(reload); +/** + * Initializes the gallery: setup the gallery |initializePromise| and invoke + * it to create the gallery. Calls reload() to populate the gallery entries. + */ +function initializeGallery() { + const promise = Promise.resolve().then(() => { + return Promise.all([loadTimeDataPromise, volumeManagerPromise]); + }); + + /** + * Define the initializePromise, which runs |promise| and then creates the + * Gallery. Define that as a 'createGallery' function here so that name is + * shown in the error stack if .catch((error)) fires. + */ + initializePromise = promise.then(function createGallery(results) { + const isReady = window.document.readyState !== 'loading'; + assert(isReady, 'Gallery DOM document is still loading'); + i18nTemplate.process(window.document, window.loadTimeData); + const volumeManager = results[1]; + gallery = new Gallery(volumeManager); + window.gallery = gallery; // for debug. + }).catch((error) => { + console.error('gallery ' + (error.stack ? error.stack : error)); + }); + + /** + * Initialize the gallery, and reload its entries. Then expose reload() on + * the global window (for background page use). + */ + initializePromise.then(reload).then(() => { + window.reload = reload; // can be called from background page. + }); +} + +/** + * Ensure the gallery.html DOM is loaded before attempting to initialize the + * gallery from script: crbug.com/882606 + */ +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', initializeGallery); +} else { + initializeGallery(); +}
diff --git a/ui/file_manager/gallery/js/gallery_scripts.js b/ui/file_manager/gallery/js/gallery_scripts.js index 00371b9..bf1fa967 100644 --- a/ui/file_manager/gallery/js/gallery_scripts.js +++ b/ui/file_manager/gallery/js/gallery_scripts.js
@@ -59,7 +59,7 @@ // <include src="../../file_manager/foreground/js/ui/file_manager_dialog_base.js"> // <include src="../../file_manager/foreground/js/ui/files_alert_dialog.js"> // <include src="../../file_manager/foreground/js/ui/files_confirm_dialog.js"> -// <include src="../../file_manager/foreground/js/volume_manager_wrapper.js"> +// <include src="../../base/js/filtered_volume_manager.js"> // <include src="image_editor/image_util.js"> // <include src="image_editor/viewport.js"> @@ -95,7 +95,4 @@ window.metrics = metrics; window.Gallery = Gallery; -window.reload = reload; // will be called by the background. -window.gallery = gallery; // for debug. - })();
diff --git a/ui/file_manager/image_loader/BUILD.gn b/ui/file_manager/image_loader/BUILD.gn index 9eda8b2..8c5fdb5 100644 --- a/ui/file_manager/image_loader/BUILD.gn +++ b/ui/file_manager/image_loader/BUILD.gn
@@ -6,6 +6,7 @@ import("//third_party/closure_compiler/js_unit_tests.gni") js_type_check("closure_compile_module") { + closure_flags = default_closure_args + [ "jscomp_error=strictCheckTypes" ] deps = [ ":background", ":cache", @@ -125,6 +126,8 @@ } js_unit_tests("unit_tests") { + # TODO(tapted): Uncomment the next line. + # closure_flags = default_closure_args + [ "jscomp_error=strictCheckTypes" ] deps = [ ":cache_unittest", ":image_loader_client_unittest",
diff --git a/ui/file_manager/image_loader/piex_loader.js b/ui/file_manager/image_loader/piex_loader.js index 65f2945..31dc2e62 100644 --- a/ui/file_manager/image_loader/piex_loader.js +++ b/ui/file_manager/image_loader/piex_loader.js
@@ -58,7 +58,7 @@ */ function PiexLoader(opt_createModule, opt_destroyModule, opt_idleTimeout) { /** - * @private {function():!Element} + * @private {function():!HTMLEmbedElement} */ this.createModule_ = opt_createModule || this.defaultCreateModule_.bind(this); @@ -73,7 +73,7 @@ PiexLoader.DEFAULT_IDLE_TIMEOUT_MS; /** - * @private {Element} + * @private {HTMLEmbedElement} */ this.naclModule_ = null; @@ -134,16 +134,17 @@ * Do not call directly. Use this.loadModule_ instead to support * tests. * - * @return {!Element} + * @return {!HTMLEmbedElement} * @private */ PiexLoader.prototype.defaultCreateModule_ = function() { - var embed = document.createElement('embed'); + var embed = + assertInstanceof(document.createElement('embed'), HTMLEmbedElement); embed.setAttribute('type', 'application/x-pnacl'); // The extension nmf is not allowed to load. We uses .nmf.js instead. embed.setAttribute('src', '/piex/piex.nmf.txt'); - embed.width = 0; - embed.height = 0; + embed.width = '0'; + embed.height = '0'; return embed; }; @@ -175,7 +176,8 @@ // instead of attaching the event listeners directly to the <EMBED> // element to ensure that the listeners are active before the NaCl module // 'load' event fires. - var listenerContainer = document.createElement('div'); + var listenerContainer = + assertInstanceof(document.createElement('div'), HTMLDivElement); listenerContainer.appendChild(this.naclModule_); listenerContainer.addEventListener('load', this.onNaclLoadBound_, true); listenerContainer.addEventListener( @@ -227,10 +229,11 @@ }; /** - * @param {Event} event + * @param {Event} listener_event * @private */ -PiexLoader.prototype.onNaclMessage_ = function(event) { +PiexLoader.prototype.onNaclMessage_ = function(listener_event) { + let event = /** @type{MessageEvent} */ (listener_event); var id = event.data.id; if (!event.data.error) { var response = new PiexLoaderResponse(event.data);
diff --git a/ui/file_manager/image_loader/request.js b/ui/file_manager/image_loader/request.js index 2d7b3a6..9baaff57 100644 --- a/ui/file_manager/image_loader/request.js +++ b/ui/file_manager/image_loader/request.js
@@ -325,7 +325,8 @@ * @private */ ImageRequest.prototype.createVideoThumbnailUrl_ = function(url) { - const video = document.createElement('video'); + const video = + assertInstanceof(document.createElement('video'), HTMLVideoElement); return Promise .race([ new Promise((resolve, reject) => { @@ -347,10 +348,12 @@ }) ]) .then(() => { - const canvas = document.createElement('canvas'); + const canvas = assertInstanceof( + document.createElement('canvas'), HTMLCanvasElement); canvas.width = video.videoWidth; canvas.height = video.videoHeight; - canvas.getContext('2d').drawImage(video, 0, 0); + assertInstanceof(canvas.getContext('2d'), CanvasRenderingContext2D) + .drawImage(video, 0, 0); return canvas.toDataURL(); }); }; @@ -481,7 +484,7 @@ * @private */ AuthorizedXHR.load_ = function(token, url, onSuccess, onFailure) { - var xhr = new XMLHttpRequest(); + let xhr = new XMLHttpRequest(); xhr.responseType = 'blob'; xhr.onreadystatechange = function() { @@ -491,9 +494,9 @@ onFailure(xhr.status); return; } - var contentType = xhr.getResponseHeader('Content-Type') || - xhr.response.type; - onSuccess(contentType, /** @type {Blob} */ (xhr.response)); + let response = /** @type {Blob} */ (xhr.response); + let contentType = xhr.getResponseHeader('Content-Type') || response.type; + onSuccess(contentType, response); }.bind(this); // Perform a xhr request. @@ -621,7 +624,6 @@ this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' + 'ABAAEAAAICTAEAOw=='; - this.xhr_.onload = function() {}; this.xhr_.abort(); // Dispose memory allocated by Canvas.
diff --git a/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js b/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js index 413060b..4115266 100644 --- a/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js +++ b/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js
@@ -400,6 +400,70 @@ }; /** + * Tests that a child folder breadcrumbs is updated when renaming its parent + * folder. crbug.com/885328. + */ +testcase.dirRenameUpdateChildrenBreadcrumbs = function() { + let appId; + testPromise( + setupAndWaitUntilReady(null, RootPath.DOWNLOADS) + .then(function(results) { + appId = results.windowId; + + // Add child-folder inside /photos/ + return new addEntries(['local'], [new TestEntryInfo({ + type: EntryType.DIRECTORY, + targetPath: 'photos/child-folder', + lastModifiedTime: 'Jan 1, 1980, 11:59 PM', + nameText: 'child-folder', + sizeText: '--', + typeText: 'Folder' + })]); + }) + .then(function() { + // Navigate to child folder. + return remoteCall.navigateWithDirectoryTree( + appId, '/photos/child-folder', 'Downloads'); + }) + .then(function() { + // Rename parent folder. + return clickDirectoryTreeContextMenuItem(appId, '/photos', 'rename') + .then(function() { + return remoteCall.waitForElement(appId, '.tree-row > input'); + }) + .then(function() { + return remoteCall.callRemoteTestUtil( + 'inputText', appId, ['.tree-row > input', 'photos-new']); + }) + .then(function() { + const enterKey = [ + '.tree-row > input', 'Enter', 'Enter', false, false, false + ]; + return remoteCall.callRemoteTestUtil( + 'fakeKeyDown', appId, enterKey); + }) + .then(function(result) { + chrome.test.assertTrue(result, 'Enter key failed'); + }); + }) + .then(function() { + // Confirm that current directory is now /Downloads, because it + // can't find the previously selected folder + // /Downloads/photos/child-folder, since its path/parent has been + // renamed. + return remoteCall.waitUntilCurrentDirectoryIsChanged( + appId, '/Downloads'); + }) + .then(function() { + // Navigate to child-folder using the new path. + // |navigateWithDirectoryTree| already checks for breadcrumbs to + // match the path. + return remoteCall.navigateWithDirectoryTree( + appId, '/photos-new/child-folder', 'Downloads'); + })); +}; + +/** * Tests renaming folder with the keyboard shortcut. */ testcase.dirRenameWithKeyboard = function() {
diff --git a/ui/file_manager/integration_tests/file_manager/drive_specific.js b/ui/file_manager/integration_tests/file_manager/drive_specific.js index 4f2104b8..6a977731 100644 --- a/ui/file_manager/integration_tests/file_manager/drive_specific.js +++ b/ui/file_manager/integration_tests/file_manager/drive_specific.js
@@ -416,3 +416,87 @@ })); }; + +// Match the way the production version formats dates. +function formatDate(date) { + var padAndConvert = function(i) { + return (i < 10 ? '0' : '') + i.toString(); + }; + + var year = date.getFullYear().toString(); + // Months are 0-based, but days aren't. + var month = padAndConvert(date.getMonth() + 1); + var day = padAndConvert(date.getDate()); + + return `${year}-${month}-${day}`; +} + +testcase.driveBackupPhotos = function() { + let appId; + + const USB_VOLUME_QUERY = '#directory-tree [volume-type-icon="removable"]'; + let date; + + StepsRunner.run([ + // Open Files app on local downloads. + function() { + setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next); + }, + // Mount USB volume in the Downloads window. + function(results) { + appId = results.windowId; + chrome.test.sendMessage( + JSON.stringify({name: 'mountFakeUsbDcim'}), this.next); + }, + // Wait for the USB mount. + function() { + remoteCall.waitForElement(appId, USB_VOLUME_QUERY).then(this.next); + }, + // Navigate to the DCIM directory. + function() { + remoteCall + .navigateWithDirectoryTree(appId, '/DCIM', 'fake-usb', 'removable') + .then(this.next); + }, + // Wait for the import button to be ready. + function() { + remoteCall + .waitForElement( + appId, '#cloud-import-button [icon="files:cloud-upload"]') + .then(this.next); + }, + // Start the import. + function() { + date = new Date(); + remoteCall + .callRemoteTestUtil('fakeMouseClick', appId, ['#cloud-import-button']) + .then(this.next); + }, + // Wait for the image to be marked as imported. + function(success) { + chrome.test.assertTrue(success); + remoteCall + .waitForElement(appId, '.status-icon[file-status-icon="imported"]') + .then(this.next); + }, + // Navigate to today's backup directory in Drive. + function() { + const formattedDate = formatDate(date); + remoteCall + .navigateWithDirectoryTree( + appId, `/root/Chrome OS Cloud backup/${formattedDate}`, + 'My Drive', 'drive') + .then(this.next); + }, + // Verify the backed-up file list contains only a copy of the image within + // DCIM in the removable storage. + function() { + const files = TestEntryInfo.getExpectedRows([ENTRIES.image3]); + remoteCall.waitForFiles(appId, files, {ignoreLastModifiedTime: true}) + .then(this.next); + }, + function() { + checkIfNoErrorsOccured(this.next); + } + ]); +};
diff --git a/ui/file_manager/video_player/js/BUILD.gn b/ui/file_manager/video_player/js/BUILD.gn index 38d3912..359597a 100644 --- a/ui/file_manager/video_player/js/BUILD.gn +++ b/ui/file_manager/video_player/js/BUILD.gn
@@ -58,12 +58,12 @@ ":media_controls", ":mouse_inactivity_watcher", ":video_player_metrics", - "../../file_manager/common/js:metrics", - "../../file_manager/common/js:util", - "../../file_manager/foreground/js:volume_manager_wrapper", - "../../image_loader:image_loader_client", "cast:cast_video_element", "cast:media_manager", + "//ui/file_manager/base/js:filtered_volume_manager", + "//ui/file_manager/file_manager/common/js:metrics", + "//ui/file_manager/file_manager/common/js:util", + "//ui/file_manager/image_loader:image_loader_client", "//ui/webui/resources/js:i18n_template_no_process", "//ui/webui/resources/js/cr/ui:menu", "//ui/webui/resources/js/cr/ui:menu_item",
diff --git a/ui/file_manager/video_player/js/video_player.js b/ui/file_manager/video_player/js/video_player.js index f041c918..b0cd3b9 100644 --- a/ui/file_manager/video_player/js/video_player.js +++ b/ui/file_manager/video_player/js/video_player.js
@@ -802,7 +802,7 @@ } function initVolumeManager(callback) { - var volumeManager = new VolumeManagerWrapper(AllowedPaths.ANY_PATH, false); + var volumeManager = new FilteredVolumeManager(AllowedPaths.ANY_PATH, false); volumeManager.ensureInitialized(callback); }
diff --git a/ui/file_manager/video_player/js/video_player_scripts.js b/ui/file_manager/video_player/js/video_player_scripts.js index 77688a2..e0d13e3 100644 --- a/ui/file_manager/video_player/js/video_player_scripts.js +++ b/ui/file_manager/video_player/js/video_player_scripts.js
@@ -43,7 +43,7 @@ // <include src="../../file_manager/common/js/file_type.js"> // <include src="../../file_manager/common/js/util.js"> // <include src="../../file_manager/common/js/volume_manager_common.js"> -// <include src="../../file_manager/foreground/js/volume_manager_wrapper.js"> +// <include src="../../base/js/filtered_volume_manager.js"> // <include src="cast/cast_extension_discoverer.js"> // <include src="cast/cast_video_element.js">
diff --git a/ui/message_center/public/cpp/features.cc b/ui/message_center/public/cpp/features.cc index d0974061..079e49b 100644 --- a/ui/message_center/public/cpp/features.cc +++ b/ui/message_center/public/cpp/features.cc
@@ -15,7 +15,4 @@ #endif }; -const base::Feature kNotificationSwipeControl{"NotificationSwipeControl", - base::FEATURE_ENABLED_BY_DEFAULT}; - } // namespace message_center
diff --git a/ui/message_center/public/cpp/features.h b/ui/message_center/public/cpp/features.h index 14a3fc2a..dadaddb 100644 --- a/ui/message_center/public/cpp/features.h +++ b/ui/message_center/public/cpp/features.h
@@ -14,10 +14,6 @@ // should be used. MESSAGE_CENTER_PUBLIC_EXPORT extern const base::Feature kNewStyleNotifications; -// Whether the swipe control on notifications should be enabled. -MESSAGE_CENTER_PUBLIC_EXPORT extern const base::Feature - kNotificationSwipeControl; - } // namespace message_center #endif // UI_MESSAGE_CENTER_PUBLIC_CPP_FEATURES_H_
diff --git a/ui/message_center/views/message_view.cc b/ui/message_center/views/message_view.cc index 21a5ed0e..5c84b54 100644 --- a/ui/message_center/views/message_view.cc +++ b/ui/message_center/views/message_view.cc
@@ -74,7 +74,9 @@ UpdateCornerRadius(0, 0); } -MessageView::~MessageView() {} +MessageView::~MessageView() { + RemovedFromWidget(); +} void MessageView::UpdateWithNotification(const Notification& notification) { pinned_ = notification.pinned(); @@ -96,8 +98,6 @@ SetBorder(views::CreateRoundedRectBorder( kNotificationBorderThickness, kNotificationCornerRadius, kBorderColor)); - if (!base::FeatureList::IsEnabled(message_center::kNotificationSwipeControl)) - return; auto* control_buttons_view = GetControlButtonsView(); if (control_buttons_view) { int control_button_count = @@ -269,6 +269,19 @@ event->SetHandled(); } +void MessageView::RemovedFromWidget() { + if (!focus_manager_) + return; + focus_manager_->RemoveFocusChangeListener(this); + focus_manager_ = nullptr; +} + +void MessageView::AddedToWidget() { + focus_manager_ = GetFocusManager(); + if (focus_manager_) + focus_manager_->AddFocusChangeListener(this); +} + ui::Layer* MessageView::GetSlideOutLayer() { return is_nested_ ? layer() : GetWidget()->GetLayer(); } @@ -288,6 +301,16 @@ true /* by_user */); } +void MessageView::OnWillChangeFocus(views::View* before, views::View* now) {} + +void MessageView::OnDidChangeFocus(views::View* before, views::View* now) { + if (Contains(before) || Contains(now) || + (GetControlButtonsView() && (GetControlButtonsView()->Contains(before) || + GetControlButtonsView()->Contains(now)))) { + UpdateControlButtonsVisibility(); + } +} + SlideOutController::SlideMode MessageView::CalculateSlideMode() const { if (disable_slide_) return SlideOutController::SlideMode::NO_SLIDE;
diff --git a/ui/message_center/views/message_view.h b/ui/message_center/views/message_view.h index 62840da0..6a62b89 100644 --- a/ui/message_center/views/message_view.h +++ b/ui/message_center/views/message_view.h
@@ -19,6 +19,7 @@ #include "ui/message_center/public/cpp/notification_delegate.h" #include "ui/message_center/views/slide_out_controller.h" #include "ui/views/animation/ink_drop_host_view.h" +#include "ui/views/focus/focus_manager.h" #include "ui/views/view.h" namespace views { @@ -38,7 +39,8 @@ // An base class for a notification entry. Contains background and other // elements shared by derived notification views. class MESSAGE_CENTER_EXPORT MessageView : public views::InkDropHostView, - public SlideOutController::Delegate { + public SlideOutController::Delegate, + public views::FocusChangeListener { public: static const char kViewClassName[]; @@ -78,7 +80,6 @@ void RequestFocusOnCloseButton(); virtual NotificationControlButtonsView* GetControlButtonsView() const = 0; - virtual void UpdateControlButtonsVisibility() = 0; virtual void SetExpanded(bool expanded); virtual bool IsExpanded() const; @@ -114,6 +115,8 @@ void OnFocus() override; void OnBlur() override; void OnGestureEvent(ui::GestureEvent* event) override; + void RemovedFromWidget() override; + void AddedToWidget() override; const char* GetClassName() const final; // message_center::SlideOutController::Delegate @@ -121,6 +124,10 @@ void OnSlideChanged() override; void OnSlideOut() override; + // views::FocusChangeListener: + void OnWillChangeFocus(views::View* before, views::View* now) override; + void OnDidChangeFocus(views::View* before, views::View* now) override; + void AddSlideObserver(SlideObserver* observer); Mode GetMode() const; @@ -145,6 +152,8 @@ // it is on top of other views. void CreateOrUpdateCloseButtonView(const Notification& notification); + virtual void UpdateControlButtonsVisibility() = 0; + // Changes the background color and schedules a paint. virtual void SetDrawBackgroundAsActive(bool active); @@ -182,6 +191,8 @@ // True if the slide is disabled forcibly. bool disable_slide_ = false; + views::FocusManager* focus_manager_ = nullptr; + DISALLOW_COPY_AND_ASSIGN(MessageView); };
diff --git a/ui/message_center/views/slidable_message_view.cc b/ui/message_center/views/slidable_message_view.cc index 51bfc20..89ae2c1 100644 --- a/ui/message_center/views/slidable_message_view.cc +++ b/ui/message_center/views/slidable_message_view.cc
@@ -23,16 +23,13 @@ // Draw on its own layer to allow bound animation. SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); - if (base::FeatureList::IsEnabled(message_center::kNotificationSwipeControl)) - SetBackground(views::CreateSolidBackground(kSwipeControlBackgroundColor)); + SetBackground(views::CreateSolidBackground(kSwipeControlBackgroundColor)); SetLayoutManager(std::make_unique<views::FillLayout>()); - if (base::FeatureList::IsEnabled(message_center::kNotificationSwipeControl)) { - control_view_ = std::make_unique<NotificationSwipeControlView>(); - AddChildView(control_view_.get()); - control_view_->AddObserver(this); - } + control_view_ = std::make_unique<NotificationSwipeControlView>(); + AddChildView(control_view_.get()); + control_view_->AddObserver(this); message_view_->AddSlideObserver(this); AddChildView(message_view); @@ -41,8 +38,6 @@ SlidableMessageView::~SlidableMessageView() = default; void SlidableMessageView::OnSlideChanged(const std::string& notification_id) { - if (!base::FeatureList::IsEnabled(message_center::kNotificationSwipeControl)) - return; float gesture_amount = message_view_->GetSlideAmount(); if (gesture_amount == 0) { control_view_->HideButtons(); @@ -99,9 +94,6 @@ void SlidableMessageView::UpdateCornerRadius(int top_radius, int bottom_radius) { - // No need to update because the background is transparent when disabled. - if (!base::FeatureList::IsEnabled(message_center::kNotificationSwipeControl)) - return; SetBackground(views::CreateBackgroundFromPainter( std::make_unique<NotificationBackgroundPainter>( top_radius, bottom_radius, kSwipeControlBackgroundColor)));
diff --git a/ui/message_center/views/slidable_message_view.h b/ui/message_center/views/slidable_message_view.h index 5671629..86e18b09 100644 --- a/ui/message_center/views/slidable_message_view.h +++ b/ui/message_center/views/slidable_message_view.h
@@ -29,14 +29,6 @@ void OnSettingsButtonPressed(const ui::Event& event) override; void OnSnoozeButtonPressed(const ui::Event& event) override; - NotificationControlButtonsView* GetControlButtonsView() { - return message_view_->GetControlButtonsView(); - } - - void UpdateControlButtonsVisibility() { - return message_view_->UpdateControlButtonsVisibility(); - } - void SetExpanded(bool expanded) { return message_view_->SetExpanded(expanded); } @@ -87,4 +79,4 @@ } // namespace message_center -#endif // UI_MESSAGE_CENTER_VIEWS_SLIDABLE_MESSAGE_VIEW_H_q \ No newline at end of file +#endif // UI_MESSAGE_CENTER_VIEWS_SLIDABLE_MESSAGE_VIEW_H_
diff --git a/ui/ozone/common/linux/gbm_wrapper.cc b/ui/ozone/common/linux/gbm_wrapper.cc index 834e021..99eed07 100644 --- a/ui/ozone/common/linux/gbm_wrapper.cc +++ b/ui/ozone/common/linux/gbm_wrapper.cc
@@ -4,9 +4,7 @@ #include "ui/ozone/common/linux/gbm_wrapper.h" -#include <fcntl.h> #include <gbm.h> -#include <xf86drm.h> #include "base/posix/eintr_wrapper.h" #include "ui/gfx/buffer_format_util.h" @@ -16,91 +14,6 @@ namespace gbm_wrapper { -namespace { - -// Minigbm and system linux gbm have some differences. There is no clear way how -// to distinguish linux gbm (Mesa, basically) and minigbm, which can be both -// third_party and minigbm. Thus, use GBM_BO_IMPORT_FD_PLANAR define to -// identify, which gbm is used. -#if defined(GBM_BO_IMPORT_FD_PLANAR) -// Minigbm defines GBM_BO_IMPORT_FD_PLANAR, which is unknown in linux gbm. -// Redefine it in a common define. -#define GBM_BO_IMPORT_FD_DATA GBM_BO_IMPORT_FD_PLANAR - -// There are some methods, which require knowing whether minigbm is used or not. -#ifndef USING_MINIGBM -#define USING_MINIGBM -#endif // USING_MINIGBM - -// Minigbm and system linux gbm have alike gbm_bo_import* structures, but some -// of the data variables have different type. -using gbm_bo_import_fd_data_with_modifier = struct gbm_import_fd_planar_data; -#else -// See comment above. Linux defines GBM_BO_IMPORT_FD_MODIFIER, thus, redefine it -// in a common define. -#define GBM_BO_IMPORT_FD_DATA GBM_BO_IMPORT_FD_MODIFIER -// See comment above. -using gbm_bo_import_fd_data_with_modifier = struct gbm_import_fd_modifier_data; -#endif - -void InitializeImportData(uint32_t format, - const gfx::Size& size, - const std::vector<base::ScopedFD>& fds, - const std::vector<gfx::NativePixmapPlane>& planes, - gbm_bo_import_fd_data_with_modifier* fd_data) { - fd_data->width = size.width(); - fd_data->height = size.height(); - fd_data->format = format; - - DCHECK_LE(planes.size(), 3u); - for (size_t i = 0; i < planes.size(); ++i) { - fd_data->fds[i] = fds[i < fds.size() ? i : 0].get(); - fd_data->strides[i] = planes[i].stride; - fd_data->offsets[i] = planes[i].offset; -#if defined(USING_MINIGBM) - fd_data->format_modifiers[i] = planes[i].modifier; -#else - fd_data->modifier = planes[i].modifier; -#endif - } -} - -int GetPlaneFdForBo(gbm_bo* bo, size_t plane) { - DCHECK(plane < gbm_bo_get_plane_count(bo)); - - // System linux gbm (or Mesa gbm) does not provide fds per plane basis. Thus, - // get plane handle and use drm ioctl to get a prime fd out of it avoid having - // two different branches for minigbm and Mesa gbm here. - gbm_device* gbm_dev = gbm_bo_get_device(bo); - int dev_fd = gbm_device_get_fd(gbm_dev); - if (dev_fd <= 0) { - LOG(ERROR) << "Unable to get device fd"; - return -1; - } - - const uint32_t plane_handle = gbm_bo_get_handle_for_plane(bo, plane).u32; - int fd = -1; - int ret; - // Use DRM_RDWR to allow the fd to be mappable in another process. - ret = drmPrimeHandleToFD(dev_fd, plane_handle, DRM_CLOEXEC | DRM_RDWR, &fd); - - // Older DRM implementations blocked DRM_RDWR, but gave a read/write mapping - // anyways - if (ret) - ret = drmPrimeHandleToFD(dev_fd, plane_handle, DRM_CLOEXEC, &fd); - - return ret ? ret : fd; -} - -size_t GetSizeOfPlane(gbm_bo* bo, size_t plane) { - // System linux gbm (or Mesa gbm) does not provide plane size. Thus, calculate - // it by ourselves and avoid having two different branches for minigbm and - // Mesa gbm here. - return gbm_bo_get_height(bo) * gbm_bo_get_stride_for_plane(bo, plane); -} - -} // namespace - class Buffer final : public ui::GbmBuffer { public: Buffer(struct gbm_bo* bo, @@ -159,7 +72,7 @@ } uint32_t GetPlaneHandle(size_t plane) const override { DCHECK_LT(plane, planes_.size()); - return gbm_bo_get_handle_for_plane(bo_, plane).u32; + return gbm_bo_get_plane_handle(bo_, plane).u32; } uint32_t GetHandle() const override { return gbm_bo_get_handle(bo_).u32; } gfx::NativePixmapHandle ExportHandle() const override { @@ -208,18 +121,11 @@ std::vector<base::ScopedFD> fds; std::vector<gfx::NativePixmapPlane> planes; - const uint64_t modifier = gbm_bo_get_modifier(bo); - const int plane_count = gbm_bo_get_plane_count(bo); - // The Mesa's gbm implementation explicitly checks whether plane count <= and - // returns 1 if the condition is true. Nevertheless, use a DCHECK here to make - // sure the condition is not broken there. - DCHECK(plane_count > 0); - // Ensure there are no differences in integer signs by casting any possible - // values to size_t. - for (size_t i = 0; i < static_cast<size_t>(plane_count); ++i) { + const uint64_t modifier = gbm_bo_get_format_modifier(bo); + for (size_t i = 0; i < gbm_bo_get_num_planes(bo); ++i) { // The fd returned by gbm_bo_get_fd is not ref-counted and need to be // kept open for the lifetime of the buffer. - base::ScopedFD fd(GetPlaneFdForBo(bo, i)); + base::ScopedFD fd(gbm_bo_get_plane_fd(bo, i)); // TODO(dcastagna): support multiple fds. // crbug.com/642410 @@ -232,9 +138,9 @@ fds.emplace_back(std::move(fd)); } - planes.emplace_back(gbm_bo_get_stride_for_plane(bo, i), - gbm_bo_get_offset(bo, i), GetSizeOfPlane(bo, i), - modifier); + planes.emplace_back(gbm_bo_get_plane_stride(bo, i), + gbm_bo_get_plane_offset(bo, i), + gbm_bo_get_plane_size(bo, i), modifier); } return std::make_unique<Buffer>(bo, format, flags, modifier, std::move(fds), size, std::move(planes)); @@ -281,21 +187,28 @@ DCHECK_EQ(planes[0].offset, 0); // Try to use scanout if supported. - int gbm_flags = GBM_BO_USE_SCANOUT; -#if defined(USING_MINIGBM) - gbm_flags |= GBM_BO_USE_TEXTURING; -#endif + int gbm_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_TEXTURING; if (!gbm_device_is_format_supported(device_, format, gbm_flags)) gbm_flags &= ~GBM_BO_USE_SCANOUT; struct gbm_bo* bo = nullptr; if (gbm_device_is_format_supported(device_, format, gbm_flags)) { - gbm_bo_import_fd_data_with_modifier fd_data; - InitializeImportData(format, size, fds, planes, &fd_data); + struct gbm_import_fd_planar_data fd_data; + fd_data.width = size.width(); + fd_data.height = size.height(); + fd_data.format = format; + + DCHECK_LE(planes.size(), 3u); + for (size_t i = 0; i < planes.size(); ++i) { + fd_data.fds[i] = fds[i < fds.size() ? i : 0].get(); + fd_data.strides[i] = planes[i].stride; + fd_data.offsets[i] = planes[i].offset; + fd_data.format_modifiers[i] = planes[i].modifier; + } // The fd passed to gbm_bo_import is not ref-counted and need to be // kept open for the lifetime of the buffer. - bo = gbm_bo_import(device_, GBM_BO_IMPORT_FD_DATA, &fd_data, gbm_flags); + bo = gbm_bo_import(device_, GBM_BO_IMPORT_FD_PLANAR, &fd_data, gbm_flags); if (!bo) { LOG(ERROR) << "nullptr returned from gbm_bo_import"; return nullptr;
diff --git a/ui/ozone/platform/drm/gpu/drm_device_manager.cc b/ui/ozone/platform/drm/gpu/drm_device_manager.cc index b165fe1..6b3214a 100644 --- a/ui/ozone/platform/drm/gpu/drm_device_manager.cc +++ b/ui/ozone/platform/drm/gpu/drm_device_manager.cc
@@ -54,8 +54,10 @@ return false; } - if (!primary_device_) + if (!primary_device_) { + VLOG(1) << "Primary DRM device added: " << path; primary_device_ = device; + } devices_.push_back(device); return true;
diff --git a/ui/ozone/platform/drm/gpu/drm_thread.cc b/ui/ozone/platform/drm/gpu/drm_thread.cc index 15b6ac3c..029a8e2 100644 --- a/ui/ozone/platform/drm/gpu/drm_thread.cc +++ b/ui/ozone/platform/drm/gpu/drm_thread.cc
@@ -152,7 +152,7 @@ std::unique_ptr<GbmBuffer>* buffer, scoped_refptr<DrmFramebuffer>* framebuffer) { scoped_refptr<ui::DrmDevice> drm = device_manager_->GetDrmDevice(widget); - DCHECK(drm); + CHECK(drm) << "No devices available for buffer allocation."; DrmWindow* window = screen_manager_->GetWindow(widget); uint32_t flags = BufferUsageToGbmFlags(usage);
diff --git a/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc b/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc index ce1d6ce..7503ba3 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc +++ b/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc
@@ -185,14 +185,14 @@ // TODO(spang): Fix this for formats other than gfx::BufferFormat::BGRA_8888 DCHECK_EQ(format, display::DisplaySnapshot::PrimaryFormat()); - VKFormat format = VK_FORMAT_B8G8R8A8_SRGB; + VkFormat vk_format = VK_FORMAT_B8G8R8A8_SRGB; VkDmaBufImageCreateInfo dma_buf_image_create_info = { /* .sType = */ static_cast<VkStructureType>( VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL), /* .pNext = */ nullptr, /* .fd = */ vk_image_fd.release(), - /* .format = */ format, + /* .format = */ vk_format, /* .extent = */ { /* .width = */ size.width(),
diff --git a/ui/ozone/platform/scenic/DEPS b/ui/ozone/platform/scenic/DEPS index 41cd997..defb45e8 100644 --- a/ui/ozone/platform/scenic/DEPS +++ b/ui/ozone/platform/scenic/DEPS
@@ -1,3 +1,4 @@ include_rules = [ "+third_party/skia/include", + "+ui/base/ime", ]
diff --git a/ui/ozone/platform/scenic/scenic_window.cc b/ui/ozone/platform/scenic/scenic_window.cc index 3f9f6264..28a9b23 100644 --- a/ui/ozone/platform/scenic/scenic_window.cc +++ b/ui/ozone/platform/scenic/scenic_window.cc
@@ -6,6 +6,7 @@ #include <fuchsia/sys/cpp/fidl.h> #include <algorithm> +#include <memory> #include <string> #include <utility> #include <vector> @@ -13,7 +14,6 @@ #include "base/fuchsia/fuchsia_logging.h" #include "ui/events/event.h" #include "ui/events/event_constants.h" -#include "ui/events/keycodes/dom/keycode_converter.h" #include "ui/events/keycodes/keyboard_code_conversion.h" #include "ui/events/ozone/events_ozone.h" #include "ui/events/platform/platform_event_source.h" @@ -22,24 +22,6 @@ namespace ui { -namespace { - -const uint32_t kUsbHidKeyboardPage = 0x07; - -int KeyModifiersToFlags(int modifiers) { - int flags = 0; - if (modifiers & fuchsia::ui::input::kModifierShift) - flags |= EF_SHIFT_DOWN; - if (modifiers & fuchsia::ui::input::kModifierControl) - flags |= EF_CONTROL_DOWN; - if (modifiers & fuchsia::ui::input::kModifierAlt) - flags |= EF_ALT_DOWN; - // TODO(crbug.com/850697): Add AltGraph support. - return flags; -} - -} // namespace - ScenicWindow::ScenicWindow( ScenicWindowManager* window_manager, PlatformWindowDelegate* delegate, @@ -48,6 +30,7 @@ : manager_(window_manager), delegate_(delegate), window_id_(manager_->AddWindow(this)), + event_dispatcher_(this), view_listener_binding_(this), scenic_session_(manager_->GetScenic(), this), input_listener_binding_(this) { @@ -68,7 +51,7 @@ scenic_session_.AddNodeChild(parent_node_id_, node_id_); // Subscribe to metrics events from the parent node. These events are used to - // get |device_pixel_ratio_| for the screen. + // get the device pixel ratio for the screen. scenic_session_.SetEventMask(parent_node_id_, fuchsia::ui::gfx::kMetricsEventMask); @@ -82,6 +65,8 @@ fit::bind_member(this, &ScenicWindow::OnViewError)); // Setup input event listener. + // TODO(crbug.com/881591): Migrate off InputConnection and use IMEService + // for receiving keyboard input instead. fuchsia::sys::ServiceProviderPtr view_service_provider; view_->GetServiceProvider(view_service_provider.NewRequest()); view_service_provider->ConnectToService( @@ -274,32 +259,12 @@ OnEventCallback callback) { bool result = false; - switch (event.Which()) { - case fuchsia::ui::input::InputEvent::Tag::kPointer: - switch (event.pointer().type) { - case fuchsia::ui::input::PointerEventType::MOUSE: - result = OnMouseEvent(event.pointer()); - break; - case fuchsia::ui::input::PointerEventType::TOUCH: - result = OnTouchEvent(event.pointer()); - break; - case fuchsia::ui::input::PointerEventType::STYLUS: - case fuchsia::ui::input::PointerEventType::INVERTED_STYLUS: - NOTIMPLEMENTED() << "Stylus input is not yet supported."; - break; - } - break; - - case fuchsia::ui::input::InputEvent::Tag::kKeyboard: - result = OnKeyboardEvent(event.keyboard()); - break; - - case fuchsia::ui::input::InputEvent::Tag::kFocus: - result = OnFocusEvent(event.focus()); - break; - - case fuchsia::ui::input::InputEvent::Tag::Invalid: - break; + if (event.is_focus()) { + LOG(ERROR) << "RECEIVED FOCUS EVENT!"; + delegate_->OnActivationChanged(event.focus().focused); + result = true; + } else { + result = event_dispatcher_.ProcessEvent(event); } callback(result); @@ -310,131 +275,14 @@ delegate_->OnClosed(); } -bool ScenicWindow::OnMouseEvent(const fuchsia::ui::input::PointerEvent& event) { - int flags = 0; - if (event.buttons & 1) - flags |= EF_LEFT_MOUSE_BUTTON; - if (event.buttons & 2) - flags |= EF_RIGHT_MOUSE_BUTTON; - if (event.buttons & 4) - flags |= EF_MIDDLE_MOUSE_BUTTON; - - EventType event_type; - - switch (event.phase) { - case fuchsia::ui::input::PointerEventPhase::DOWN: - event_type = ET_MOUSE_PRESSED; - break; - case fuchsia::ui::input::PointerEventPhase::MOVE: - event_type = flags ? ET_MOUSE_DRAGGED : ET_MOUSE_MOVED; - break; - case fuchsia::ui::input::PointerEventPhase::UP: - event_type = ET_MOUSE_RELEASED; - break; - - // Following phases are not expected for mouse events. - case fuchsia::ui::input::PointerEventPhase::HOVER: - case fuchsia::ui::input::PointerEventPhase::CANCEL: - case fuchsia::ui::input::PointerEventPhase::ADD: - case fuchsia::ui::input::PointerEventPhase::REMOVE: - NOTREACHED() << "Unexpected mouse phase " - << fidl::ToUnderlying(event.phase); - return false; +void ScenicWindow::DispatchEvent(ui::Event* event) { + if (event->IsLocatedEvent()) { + ui::LocatedEvent* located_event = event->AsLocatedEvent(); + gfx::PointF location = located_event->location_f(); + location.Scale(device_pixel_ratio_); + located_event->set_location_f(location); } - - gfx::Point location = - gfx::Point(event.x * device_pixel_ratio_, event.y * device_pixel_ratio_); - ui::MouseEvent mouse_event(event_type, location, location, - base::TimeTicks::FromZxTime(event.event_time), - flags, 0); - delegate_->DispatchEvent(&mouse_event); - return true; -} - -bool ScenicWindow::OnTouchEvent(const fuchsia::ui::input::PointerEvent& event) { - EventType event_type; - - switch (event.phase) { - case fuchsia::ui::input::PointerEventPhase::DOWN: - event_type = ET_TOUCH_PRESSED; - break; - case fuchsia::ui::input::PointerEventPhase::MOVE: - event_type = ET_TOUCH_MOVED; - break; - case fuchsia::ui::input::PointerEventPhase::CANCEL: - event_type = ET_TOUCH_CANCELLED; - break; - case fuchsia::ui::input::PointerEventPhase::UP: - event_type = ET_TOUCH_RELEASED; - break; - case fuchsia::ui::input::PointerEventPhase::ADD: - case fuchsia::ui::input::PointerEventPhase::REMOVE: - case fuchsia::ui::input::PointerEventPhase::HOVER: - return false; - } - - // TODO(crbug.com/876933): Add more detailed fields such as - // force/orientation/tilt once they are added to PointerEvent. - ui::PointerDetails pointer_details(ui::EventPointerType::POINTER_TYPE_TOUCH, - event.pointer_id); - - gfx::Point location = - gfx::Point(event.x * device_pixel_ratio_, event.y * device_pixel_ratio_); - ui::TouchEvent touch_event(event_type, location, - base::TimeTicks::FromZxTime(event.event_time), - pointer_details); - - delegate_->DispatchEvent(&touch_event); - return true; -} - -bool ScenicWindow::OnKeyboardEvent( - const fuchsia::ui::input::KeyboardEvent& event) { - EventType event_type; - - switch (event.phase) { - case fuchsia::ui::input::KeyboardEventPhase::PRESSED: - case fuchsia::ui::input::KeyboardEventPhase::REPEAT: - event_type = ET_KEY_PRESSED; - break; - - case fuchsia::ui::input::KeyboardEventPhase::RELEASED: - event_type = ET_KEY_RELEASED; - break; - - case fuchsia::ui::input::KeyboardEventPhase::CANCELLED: - NOTIMPLEMENTED() << "Key event cancellation is not supported."; - event_type = ET_KEY_RELEASED; - break; - } - - // Currently KeyboardEvent doesn't specify HID Usage page. |hid_usage| - // field always contains values from the Keyboard page. See - // https://fuchsia.atlassian.net/browse/SCN-762 . - DomCode dom_code = KeycodeConverter::UsbKeycodeToDomCode( - (kUsbHidKeyboardPage << 16) | event.hid_usage); - DomKey dom_key; - KeyboardCode key_code; - if (!DomCodeToUsLayoutDomKey(dom_code, KeyModifiersToFlags(event.modifiers), - &dom_key, &key_code)) { - LOG(ERROR) << "DomCodeToUsLayoutDomKey() failed for usb_key: " - << event.hid_usage; - key_code = VKEY_UNKNOWN; - } - - if (event.code_point) - dom_key = DomKey::FromCharacter(event.code_point); - - KeyEvent key_event(event_type, key_code, dom_code, - KeyModifiersToFlags(event.modifiers), dom_key, - base::TimeTicks::FromZxTime(event.event_time)); - delegate_->DispatchEvent(&key_event); - return true; -} - -bool ScenicWindow::OnFocusEvent(const fuchsia::ui::input::FocusEvent& event) { - delegate_->OnActivationChanged(event.focused); - return true; + delegate_->DispatchEvent(event); } } // namespace ui
diff --git a/ui/ozone/platform/scenic/scenic_window.h b/ui/ozone/platform/scenic/scenic_window.h index 8aecd40..9dba22b 100644 --- a/ui/ozone/platform/scenic/scenic_window.h +++ b/ui/ozone/platform/scenic/scenic_window.h
@@ -11,6 +11,8 @@ #include <vector> #include "base/macros.h" +#include "ui/events/fuchsia/input_event_dispatcher.h" +#include "ui/events/fuchsia/input_event_dispatcher_delegate.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size_f.h" @@ -27,7 +29,8 @@ class OZONE_EXPORT ScenicWindow : public PlatformWindow, public ScenicSessionListener, public fuchsia::ui::viewsv1::ViewListener, - public fuchsia::ui::input::InputListener { + public fuchsia::ui::input::InputListener, + public InputEventDispatcherDelegate { public: // Both |window_manager| and |delegate| must outlive the ScenicWindow. // |view_owner_request| is passed to the view managed when creating the @@ -41,7 +44,6 @@ ScenicSession* scenic_session() { return &scenic_session_; } ScenicSession::ResourceId node_id() const { return node_id_; } - float device_pixel_ratio() const { return device_pixel_ratio_; } // Sets texture of the window to a scenic resource. void SetTexture(ScenicSession::ResourceId texture); @@ -83,22 +85,22 @@ void OnScenicEvents( const std::vector<fuchsia::ui::scenic::Event>& events) override; + // InputEventDispatcher::Delegate interface. + void DispatchEvent(ui::Event* event) override; + // Error handler for |view_|. This error normally indicates the View was // destroyed (e.g. dropping ViewOwner). void OnViewError(); void UpdateSize(); - // Handlers for Fuchsia input event specializations. - bool OnMouseEvent(const fuchsia::ui::input::PointerEvent& event); - bool OnKeyboardEvent(const fuchsia::ui::input::KeyboardEvent& event); - bool OnTouchEvent(const fuchsia::ui::input::PointerEvent& event); - bool OnFocusEvent(const fuchsia::ui::input::FocusEvent& event); - ScenicWindowManager* const manager_; PlatformWindowDelegate* const delegate_; gfx::AcceleratedWidget const window_id_; + // Dispatches Scenic input events as Chrome ui::Events. + InputEventDispatcher event_dispatcher_; + // Underlying View in the view_manager. fuchsia::ui::viewsv1::ViewPtr view_; fidl::Binding<fuchsia::ui::viewsv1::ViewListener> view_listener_binding_; @@ -118,16 +120,16 @@ ScenicSession::ResourceId shape_id_; ScenicSession::ResourceId material_id_; + // The ratio used for translating device-independent coordinates to absolute + // pixel coordinates. + float device_pixel_ratio_; + // Current view size in DIPs. gfx::SizeF size_dips_; // Current view size in device pixels. gfx::Size size_pixels_; - // Device pixel ratio for the current device. Initialized in - // OnPropertiesChanged(). - float device_pixel_ratio_ = 0.0; - // InputConnection and InputListener binding used to receive input events from // the view. fuchsia::ui::input::InputConnectionPtr input_connection_;
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 81a325fd..f959a2a 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc
@@ -2089,10 +2089,9 @@ const int right_of_parent = item_loc.x() + item->width() - submenu_horizontal_inset; - int border_size = menu_config.CornerRadiusForMenu(this); - if (!border_size) - border_size = menu_config.menu_vertical_border_size; - menu_bounds.set_y(item_loc.y() - border_size); + MenuScrollViewContainer* container = + item->GetParentMenuItem()->GetSubmenu()->GetScrollViewContainer(); + menu_bounds.set_y(item_loc.y() - container->border()->GetInsets().top()); // Assume the menu can be placed in the preferred location. menu_bounds.set_x(create_on_right ? right_of_parent : left_of_parent);
diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc index 18d9315..56fc98b2 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc
@@ -116,7 +116,7 @@ if (!is_attempting_close_dialog_) { // Fire beforeunload event when user attempts to close the dialog. is_attempting_close_dialog_ = true; - web_view_->web_contents()->DispatchBeforeUnload(); + web_view_->web_contents()->DispatchBeforeUnload(false /* auto_cancel */); } return false; }
diff --git a/ui/webui/resources/js/webui_resource_test.js b/ui/webui/resources/js/webui_resource_test.js index 92641899..ea7089b0 100644 --- a/ui/webui/resources/js/webui_resource_test.js +++ b/ui/webui/resources/js/webui_resource_test.js
@@ -211,6 +211,17 @@ } catch (err) { cleanTestRun = false; } + startTesting(); +} + +/** + * @suppress {missingProperties} + */ +function startTesting() { + if (window.waitUser) { + setTimeout(startTesting, 1000); + return; + } continueTesting(); }
diff --git a/webrunner/app/sandbox_policy b/webrunner/app/sandbox_policy index a3bfa2b..aa36caa 100644 --- a/webrunner/app/sandbox_policy +++ b/webrunner/app/sandbox_policy
@@ -7,6 +7,8 @@ "fuchsia.net.LegacySocketProvider", "fuchsia.netstack.Netstack", "fuchsia.process.Launcher", + "fuchsia.ui.input.ImeService", + "fuchsia.ui.input.ImeVisibilityService", "fuchsia.ui.scenic.Scenic", "fuchsia.ui.viewsv1.ViewManager", "fuchsia.vulkan.loader.Loader"