blob: 9e2524b5926ecc2ee4f3c702961f0d29146c8314 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test()
{
let suite = InspectorTest.createAsyncSuite("CSS.StyleSheetEvents.InspectorStyleSheet");
suite.addTestCase({
name: "CheckNoStyleSheets",
description: "Ensure there are currently no stylesheets.",
test(resolve, reject) {
InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 0, "Should be no stylesheets.");
resolve();
}
});
suite.addTestCase({
name: "CreateInspectorStyleSheet",
description: "Creating an inspector stylesheet adds a stylesheet.",
test(resolve, reject) {
WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetAdded)
.then((event) => {
InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 1, "Should be one stylesheet.");
InspectorTest.assert(event.data.styleSheet instanceof WI.CSSStyleSheet, "Event data should be a CSSStyleSheet");
InspectorTest.expectThat(event.data.styleSheet.origin === WI.CSSStyleSheet.Type.Inspector, "StyleSheet origin should be 'inspector'.");
})
.then(resolve, reject);
CSSAgent.createStyleSheet(WI.frameResourceManager.mainFrame.id);
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Test for CSS.styleSheetAdded for Inspector stylesheets.</p>
</body>
</html>