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 var id1 = chrome.contextMenus.create(
8 {"id": "id1", "title": "title1"}, function() {
9 chrome.test.assertNoLastError();
10 chrome.test.assertEq("id1", id1);
11 chrome.contextMenus.remove("id1", chrome.test.callbackPass());
15 function parentStringID() {
16 chrome.contextMenus.create({"id": "id1", "title": "title1"}, function() {
17 chrome.test.assertNoLastError();
18 chrome.contextMenus.create(
19 {"title": "title2", "parentId": "id1"}, function() {
20 chrome.test.assertNoLastError();
21 chrome.contextMenus.create(
22 {"id": "id3", "title": "title3"}, function() {
23 chrome.test.assertNoLastError();
24 chrome.contextMenus.update("id3", {"parentId": "id1"},
25 chrome.test.callbackPass());
31 function idCollision() {
32 chrome.contextMenus.create({"id": "mine", "title": "first"}, function() {
33 chrome.contextMenus.create({"id": "mine", "title": "second"},
34 chrome.test.callbackFail("Cannot create item with duplicate id mine"));
38 function idNonCollision() {
39 var intId = chrome.contextMenus.create({"title": "int17"}, function() {
40 chrome.test.assertNoLastError();
41 var stringId = String(intId);
42 chrome.contextMenus.create(
43 {"id": stringId, "title": "string17"}, function() {
44 chrome.test.assertNoLastError();
45 chrome.contextMenus.remove(intId, function() {
46 chrome.test.assertNoLastError();
47 chrome.contextMenus.remove(stringId, chrome.test.callbackPass());