Bug 1740089 - Fall back to frame (accentcolor) to determine toolbar theme. r=desktop-theme-reviewers,harry

Depends on D130669

Differential Revision: https://phabricator.services.mozilla.com/D130670
This commit is contained in:
Emilio Cobos Álvarez
2021-11-09 03:58:02 +00:00
parent 229e9dd731
commit 1afe04e622
2 changed files with 18 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
"use strict";
add_task(async function testThemeDeterminesToolbarQuery() {
async function testThemeDeterminesToolbarQuery(toolbarProp) {
let darkModeQuery = window.matchMedia("(-moz-system-dark-theme)");
let darkToolbarQuery = window.matchMedia("(prefers-color-scheme: dark)");
@@ -16,7 +16,7 @@ add_task(async function testThemeDeterminesToolbarQuery() {
},
theme: {
colors: {
toolbar: "rgba(12, 12, 12, 1)",
[toolbarProp]: "rgba(12, 12, 12, 1)",
},
},
},
@@ -30,7 +30,7 @@ add_task(async function testThemeDeterminesToolbarQuery() {
},
theme: {
colors: {
toolbar: "rgba(255, 255, 255, 1)",
[toolbarProp]: "rgba(255, 255, 255, 1)",
},
},
},
@@ -45,7 +45,7 @@ add_task(async function testThemeDeterminesToolbarQuery() {
},
theme: {
colors: {
toolbar: "rgba(12, 12, 12, 1)",
[toolbarProp]: "rgba(12, 12, 12, 1)",
ntp_background: "rgba(255, 255, 255, 1)",
},
},
@@ -61,7 +61,7 @@ add_task(async function testThemeDeterminesToolbarQuery() {
},
theme: {
colors: {
toolbar: "rgba(255, 255, 255, 1)",
[toolbarProp]: "rgba(255, 255, 255, 1)",
ntp_background: "rgba(12, 12, 12, 1)",
},
},
@@ -187,4 +187,13 @@ add_task(async function testThemeDeterminesToolbarQuery() {
}
BrowserTestUtils.removeTab(contentTab);
BrowserTestUtils.removeTab(preferencesTab);
}
add_task(function test_toolbar() {
return testThemeDeterminesToolbarQuery("toolbar");
});
// Assert that we fall back to "frame" (accentcolor) if toolbar is not present.
add_task(function test_frame() {
return testThemeDeterminesToolbarQuery("frame");
});