43 lines
1.5 KiB
HTML
43 lines
1.5 KiB
HTML
<!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.cssManager.styleSheets.length === 0, "Should be no stylesheets.");
|
|
resolve();
|
|
}
|
|
});
|
|
|
|
suite.addTestCase({
|
|
name: "CreateInspectorStyleSheet",
|
|
description: "Creating an inspector stylesheet adds a stylesheet.",
|
|
test(resolve, reject) {
|
|
WI.cssManager.awaitEvent(WI.CSSManager.Event.StyleSheetAdded)
|
|
.then((event) => {
|
|
InspectorTest.expectThat(WI.cssManager.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.networkManager.mainFrame.id);
|
|
}
|
|
});
|
|
|
|
suite.runTestCasesAndFinish();
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="runTest()">
|
|
<p>Test for CSS.styleSheetAdded for Inspector stylesheets.</p>
|
|
</body>
|
|
</html>
|