chromium/third_party/blink/web_tests/fast/frames/resources/sandboxed-iframe-storage-disallowed.html

<html>
<head>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

function debug(msg)
{
    var span = document.createElement("span");
    document.getElementById("console").appendChild(span);
    span.innerHTML = msg + '<br />';
}

function escapeHTML(text)
{
    return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\0/g, "\\0");
}

function testPassed(msg)
{
    debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
}

function testFailed(msg)
{
    debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
}

function shouldThrow(_a, _e)
{
  var exception;
  var _av;
  try {
     _av = eval(_a);
  } catch (e) {
     exception = e;
  }

  var _ev;
  if (_e)
      _ev =  eval(_e);

  if (exception) {
    if (typeof _e == "undefined" || exception == _ev)
      testPassed(_a + " threw exception \"" + exception + "\".");
    else
      testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + ".");
  } else if (typeof _av == "undefined")
    testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
  else
    testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
}
</script>
<script>

window.onload = function() {
    shouldThrow("window.indexedDB.open('foo')", '"SecurityError: Failed to execute \'open\' on \'IDBFactory\': access to the Indexed Database API is denied in this context."');
    shouldThrow("window.indexedDB.deleteDatabase('foo')", '"SecurityError: Failed to execute \'deleteDatabase\' on \'IDBFactory\': access to the Indexed Database API is denied in this context."');
    shouldThrow("window.localStorage", '"SecurityError: Failed to read the \'localStorage\' property from \'Window\': The document is sandboxed and lacks the \'allow-same-origin\' flag."');
    shouldThrow("window.sessionStorage", '"SecurityError: Failed to read the \'sessionStorage\' property from \'Window\': The document is sandboxed and lacks the \'allow-same-origin\' flag."');
    shouldThrow("document.cookie",'"SecurityError: Failed to read the \'cookie\' property from \'Document\': The document is sandboxed and lacks the \'allow-same-origin\' flag."') ;
}

</script>
</head>
<body>
    <div id="console"></div>
</body>
</html>