Created
August 5, 2016 20:48
-
-
Save allada/121f571286fe9826e15144dc62ab9d39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extract(data) { | |
var findTestFunction = /(\s*function\s+)test\s*\(([^)]*)\)(\s*{?)/; | |
data = data.replace(findTestFunction, "$1innerTest($2)\$3"); | |
var findBody = /<body(?:\s+[^>]*)?>([\s\S]*)<\/body>/; | |
body = data.match(findBody)[1]; | |
var findScriptsFunction = /<script\s+.*src="([^"]+)"/g | |
var match; | |
var scripts = []; | |
while (match = findScriptsFunction.exec(data)) { | |
scripts.push(match[1]); | |
} | |
return [data, body, scripts]; | |
} | |
extract(`<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="import" href="resources/import-open-inspector-linked.html"> | |
<script src="../http/tests/inspector/inspector-test.js"></script> | |
<script> | |
function getGreeting() | |
{ | |
return window.greeting; | |
} | |
function test() | |
{ | |
InspectorTest.runTestSuite([ | |
function checkGreetingSet(next) | |
{ | |
InspectorTest.evaluateInPage("getGreeting()", callback); | |
function callback(result) | |
{ | |
InspectorTest.addResult("Received: " + result.value); | |
next(); | |
} | |
}, | |
function reloadPage(next) | |
{ | |
InspectorTest.reloadPage(next); | |
}, | |
function checkReloaded(next) | |
{ | |
InspectorTest.addResult("Page successfully reloaded"); | |
next(); | |
} | |
]); | |
} | |
</script> | |
</head> | |
<body onload="runTest()"> | |
<p> | |
This tests that reloading a page with the inspector opened does not crash (rewritten test from r156199). | |
</p> | |
</body> | |
</html> | |
`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment