chromium/third_party/blink/web_tests/fast/selectors/selection-window-inactive.html

<!DOCTYPE html>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<style>
::selection {
    background-color: blue;
    color: yellow;
}
::selection:window-inactive {
    background-color: rgba(63, 128, 33, 0.95); /* green; alpha < 1 so that we don't blend the background color with white. */ 
    color: black;
}
</style>
<span>Any textual selection in this sentence should have a green background when the window is inactive.</span>
<script>
if (window.testRunner) {
  testRunner.waitUntilDone();
}
onload = function() {
    var span = document.querySelector("span");
    window.getSelection().setBaseAndExtent(span, 0, span, 1);

    runAfterLayoutAndPaint(function() {
        if (window.testRunner)
            testRunner.setWindowFocus(false);
        runAfterLayoutAndPaint(function() {
        }, true);
    }, false);
}
</script>