Commit 50d9048f authored by Sam Sebree's avatar Sam Sebree Committed by Chromium LUCI CQ

[Controls Refresh] Implement test coverage for dark mode scrollbars are not...

[Controls Refresh] Implement test coverage for dark mode scrollbars are not dynamically updated bugfix

Due to time constraints, the following CL was landed without full test coverage:
https://chromium-review.googlesource.com/c/chromium/src/+/2522563/7

This CL adds proper test coverage for the change.

Bug: 1148004
Change-Id: I693c7dcb3d1d9c250e730eba1f63212f9caf4349
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2564600
Commit-Queue: Sam Sebree <sasebree@microsoft.com>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832298}
parent 2b73e0d6
...@@ -3143,6 +3143,15 @@ void Internals::forceCompositingUpdate(Document* document, ...@@ -3143,6 +3143,15 @@ void Internals::forceCompositingUpdate(Document* document,
document->GetFrame()->View()->UpdateAllLifecyclePhasesForTest(); document->GetFrame()->View()->UpdateAllLifecyclePhasesForTest();
} }
void Internals::setForcedColorsAndDarkPreferredColorScheme(Document* document) {
DCHECK(document);
ColorSchemeHelper color_scheme_helper(*document);
color_scheme_helper.SetPreferredColorScheme(
mojom::blink::PreferredColorScheme::kDark);
color_scheme_helper.SetForcedColors(*document, ForcedColors::kActive);
document->GetFrame()->View()->UpdateAllLifecyclePhasesForTest();
}
void Internals::setShouldRevealPassword(Element* element, void Internals::setShouldRevealPassword(Element* element,
bool reveal, bool reveal,
ExceptionState& exception_state) { ExceptionState& exception_state) {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/core/css/css_computed_style_declaration.h" #include "third_party/blink/renderer/core/css/css_computed_style_declaration.h"
#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h" #include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h"
#include "third_party/blink/renderer/core/testing/color_scheme_helper.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
...@@ -472,6 +473,8 @@ class Internals final : public ScriptWrappable { ...@@ -472,6 +473,8 @@ class Internals final : public ScriptWrappable {
void forceCompositingUpdate(Document*, ExceptionState&); void forceCompositingUpdate(Document*, ExceptionState&);
void setForcedColorsAndDarkPreferredColorScheme(Document* document);
void setShouldRevealPassword(Element*, bool, ExceptionState&); void setShouldRevealPassword(Element*, bool, ExceptionState&);
ScriptPromise createResolvedPromise(ScriptState*, ScriptValue); ScriptPromise createResolvedPromise(ScriptState*, ScriptValue);
......
...@@ -298,6 +298,8 @@ ...@@ -298,6 +298,8 @@
[RaisesException] void forceCompositingUpdate(Document document); [RaisesException] void forceCompositingUpdate(Document document);
void setForcedColorsAndDarkPreferredColorScheme(Document document);
[RaisesException] void setShouldRevealPassword(Element element, boolean reveal); [RaisesException] void setShouldRevealPassword(Element element, boolean reveal);
[CallWith=ScriptState] Promise<any> createResolvedPromise(any value); [CallWith=ScriptState] Promise<any> createResolvedPromise(any value);
......
<!DOCTYPE html>
<head>
<meta name="color-scheme" content="light dark">
<script src="../../../../resources/run-after-layout-and-paint.js"></script>
<script>
function endTest() {
if (window.testRunner)
testRunner.notifyDone();
}
function doTest() {
window.internals.setForcedColorsAndDarkPreferredColorScheme(document);
runAfterLayoutAndPaint(endTest);
}
runAfterLayoutAndPaint(doTest);
if (window.testRunner)
testRunner.waitUntilDone();
</script>
</head>
<body style='height:5000px; width:5000px'></body>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment