Html程序  |  54行  |  1.36 KB

<html>
  <head>
    <script type="text/javascript"
            src="chrome_frame_tester_helpers.js"></script>
    <script type="text/javascript"
            src="CFInstall.js"></script>
  </head>
  <body>
    <div id="statusPanel" style="border: 1px solid red; width: 100%">
      Test running....
    </div>

    <script type="text/javascript">
      var testName = 'CFInstallDismiss';
      (function(){
        try{
          // Testing over-rides for GCF detection code.
          CFInstall._force = true;
          CFInstall._forceValue = false;

          // Clobber prompt suppression cookie if set.
          document.cookie = 'disableGCFCheck=0;path=/';

          CFInstall.check({
            id: 'prompt',
            mode: 'overlay'
          });

          var p = byId('prompt');

          if (!p) {
            onFailure(testName, 1, 'prompt not created with correct ID');
            return;
          }

          byId('chromeFrameCloseButton').click();

          if (document.cookie.indexOf('disableGCFCheck=1') == -1) {
            onFailure(testName, 1, 'dismiss cookie not set');
            return;
          }

          onSuccess(testName, 1);

        } catch (e) {
          onFailure(testName, 1,
                    'CFInstall overlay prompt failed with error: '+e);
        }
      })();
    </script>
    <p>Tests CFInstall overlay prompt</p>
  </body>
</html>