| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 chrome.test.runTests([ | 5 chrome.test.runTests([ |
| 6 function stringID() { | 6 function stringID() { |
| 7 var id1 = chrome.contextMenus.create( | 7 var id1 = chrome.contextMenus.create( |
| 8 {"id": "id1", "title": "title1"}, function() { | 8 {"id": "id1", "title": "title1"}, function() { |
| 9 chrome.test.assertNoLastError(); | 9 chrome.test.assertNoLastError(); |
| 10 chrome.test.assertEq("id1", id1); | 10 chrome.test.assertEq("id1", id1); |
| 11 chrome.contextMenus.remove("id1", chrome.test.callbackPass()); | 11 chrome.contextMenus.remove("id1", chrome.test.callbackPass()); |
| 12 }); | 12 }); |
| 13 }, | 13 }, |
| 14 | 14 |
| 15 function generatedID() { | 15 function generatedID() { |
| 16 chrome.contextMenus.create( | 16 chrome.contextMenus.create( |
| 17 {"title": "title2"}, | 17 {"title": "title2"}, |
| 18 chrome.test.callbackFail("Extensions using event pages must pass an " + | 18 chrome.test.callbackFail("Extensions using event pages must pass an " + |
| 19 "id parameter to chrome.contextMenus.create")); | 19 "id parameter to chrome.contextMenus.create")); |
| 20 }, |
| 21 |
| 22 function noOnClick() { |
| 23 chrome.contextMenus.create( |
| 24 {"id": "id3", "title": "title3", "onclick": function() {}}, |
| 25 chrome.test.callbackFail( |
| 26 "Extensions using event pages cannot pass an onclick parameter " + |
| 27 "to chrome.contextMenus.create. Instead, use the " + |
| 28 "chrome.contextMenus.onClicked event.")); |
| 20 } | 29 } |
| 21 ]); | 30 ]); |
| OLD | NEW |