Skip to content

Commit

Permalink
[Controls Refresh] Implement test coverage for dark mode scrollbars a…
Browse files Browse the repository at this point in the history
…re 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: Kent Tamura <tkent@chromium.org>
Reviewed-by: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832298}
  • Loading branch information
Sam Sebree authored and Chromium LUCI CQ committed Dec 1, 2020
1 parent 2b73e0d commit 50d9048
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions third_party/blink/renderer/core/testing/internals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3143,6 +3143,15 @@ void Internals::forceCompositingUpdate(Document* document,
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,
bool reveal,
ExceptionState& exception_state) {
Expand Down
3 changes: 3 additions & 0 deletions third_party/blink/renderer/core/testing/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#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/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/script_state.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
Expand Down Expand Up @@ -472,6 +473,8 @@ class Internals final : public ScriptWrappable {

void forceCompositingUpdate(Document*, ExceptionState&);

void setForcedColorsAndDarkPreferredColorScheme(Document* document);

void setShouldRevealPassword(Element*, bool, ExceptionState&);

ScriptPromise createResolvedPromise(ScriptState*, ScriptValue);
Expand Down
2 changes: 2 additions & 0 deletions third_party/blink/renderer/core/testing/internals.idl
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@

[RaisesException] void forceCompositingUpdate(Document document);

void setForcedColorsAndDarkPreferredColorScheme(Document document);

[RaisesException] void setShouldRevealPassword(Element element, boolean reveal);

[CallWith=ScriptState] Promise<any> createResolvedPromise(any value);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!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>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 50d9048

Please sign in to comment.