function testOpenCloseBookmarks() {
    var toolbar = $('toolbar');
    toolbar.show();
    var dropdown = toolbar.$.bookmarks;
    var plugin = $('plugin');
    var ESC_KEY = 27;

    // Clicking on the plugin should close the bookmarks menu.
    chrome.test.assertFalse(dropdown.dropdownOpen);
    MockInteractions.tap(dropdown.$.icon);
    chrome.test.assertTrue(dropdown.dropdownOpen);
    MockInteractions.tap(plugin);
    chrome.test.assertFalse(dropdown.dropdownOpen,
        "Clicking plugin closes dropdown");

    MockInteractions.tap(dropdown.$.icon);
    chrome.test.assertTrue(dropdown.dropdownOpen);
    MockInteractions.pressAndReleaseKeyOn(document, ESC_KEY);
    chrome.test.assertFalse(dropdown.dropdownOpen,
        "Escape key closes dropdown");
    chrome.test.assertTrue(toolbar.opened,
        "First escape key does not close toolbar");

    MockInteractions.pressAndReleaseKeyOn(document, ESC_KEY);
    chrome.test.assertFalse(toolbar.opened,
        "Second escape key closes toolbar");

    chrome.test.succeed();
  }
/**
   * Test that the bookmarks menu can be closed by clicking the plugin and
   * pressing escape.
   */
Test that the bookmarks menu can be closed by clicking the plugin and
pressing escape.
Test that the bookmarks menu can be closed by clicking the plugin and pressing escape .
function testOpenCloseBookmarks() {
    var toolbar = $('toolbar');
    toolbar.show();
    var dropdown = toolbar.$.bookmarks;
    var plugin = $('plugin');
    var ESC_KEY = 27;
    chrome.test.assertFalse(dropdown.dropdownOpen);
    MockInteractions.tap(dropdown.$.icon);
    chrome.test.assertTrue(dropdown.dropdownOpen);
    MockInteractions.tap(plugin);
    chrome.test.assertFalse(dropdown.dropdownOpen,
        "Clicking plugin closes dropdown");
    MockInteractions.tap(dropdown.$.icon);
    chrome.test.assertTrue(dropdown.dropdownOpen);
    MockInteractions.pressAndReleaseKeyOn(document, ESC_KEY);
    chrome.test.assertFalse(dropdown.dropdownOpen,
        "Escape key closes dropdown");
    chrome.test.assertTrue(toolbar.opened,
        "First escape key does not close toolbar");
    MockInteractions.pressAndReleaseKeyOn(document, ESC_KEY);
    chrome.test.assertFalse(toolbar.opened,
        "Second escape key closes toolbar");
    chrome.test.succeed();
  }
function testOpenCloseBookmarks ( ) { var toolbar = $ ( 'toolbar' ) ; toolbar . show ( ) ; var dropdown = toolbar . $ . bookmarks ; var plugin = $ ( 'plugin' ) ; var ESC_KEY = 27 ; chrome . test . assertFalse ( dropdown . dropdownOpen ) ; MockInteractions . tap ( dropdown . $ . icon ) ; chrome . test . assertTrue ( dropdown . dropdownOpen ) ; MockInteractions . tap ( plugin ) ; chrome . test . assertFalse ( dropdown . dropdownOpen , "Clicking plugin closes dropdown" ) ; MockInteractions . tap ( dropdown . $ . icon ) ; chrome . test . assertTrue ( dropdown . dropdownOpen ) ; MockInteractions . pressAndReleaseKeyOn ( document , ESC_KEY ) ; chrome . test . assertFalse ( dropdown . dropdownOpen , "Escape key closes dropdown" ) ; chrome . test . assertTrue ( toolbar . opened , "First escape key does not close toolbar" ) ; MockInteractions . pressAndReleaseKeyOn ( document , ESC_KEY ) ; chrome . test . assertFalse ( toolbar . opened , "Second escape key closes toolbar" ) ; chrome . test . succeed ( ) ; }
Test that the bookmarks menu can be closed by clicking the plugin and
 pressing escape.
Test that the bookmarks menu can be closed by clicking the plugin and pressing escape .
// Clicking on the plugin should close the bookmarks menu.