1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 // Tests the chrome.commands.getAll API returns sane values and that an
8 // extension with a browser action gets a synthesized extension command with
9 // an inactive shortcut.
11 // Run with browser_tests:
12 // --gtest_filter=CommandsApiTest.SynthesizedCommand
14 // Called when the user clicks on the browser action.
15 chrome
.browserAction
.onClicked
.addListener(function(windowId
) {
18 chrome
.commands
.getAll(function(commands
) {
19 chrome
.test
.assertEq(2, commands
.length
);
21 // A browser actions gets a synthesized command with no shortcut and no
23 chrome
.test
.assertEq("_execute_browser_action", commands
[0].name
);
24 chrome
.test
.assertEq("", commands
[0].description
);
25 chrome
.test
.assertEq("", commands
[0].shortcut
);
27 // This one on the other hand, has it all.
28 chrome
.test
.assertEq("unrelated-feature", commands
[1].name
);
29 chrome
.test
.assertEq("Toggle feature foo", commands
[1].description
);
30 chrome
.test
.assertEq("Ctrl+Shift+Y", commands
[1].shortcut
);
32 chrome
.test
.notifyPass();