OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 var make_browsertest_proceed = function() { | 5 var make_browsertest_proceed = function() { |
6 if (!chrome.extension.lastError) { | 6 if (!chrome.runtime.lastError) { |
7 chrome.test.sendMessage("created items"); | 7 chrome.test.sendMessage("created items"); |
8 } | 8 } |
9 }; | 9 }; |
10 | 10 |
11 var patterns = ["http://*.google.com/*", "https://*.google.com/*"]; | 11 var patterns = ["http://*.google.com/*", "https://*.google.com/*"]; |
12 | 12 |
13 window.onload = function() { | 13 window.onload = function() { |
14 // Create one item that does have a documentUrlPattern. | 14 // Create one item that does have a documentUrlPattern. |
15 var properties1 = { | 15 var properties1 = { |
16 "title": "test_item1", "documentUrlPatterns": patterns | 16 "title": "test_item1", "documentUrlPatterns": patterns |
17 }; | 17 }; |
18 chrome.contextMenus.create(properties1); | 18 chrome.contextMenus.create(properties1); |
19 | 19 |
20 // Create an item that initially doesn't have a documentUrlPattern, then | 20 // Create an item that initially doesn't have a documentUrlPattern, then |
21 // update it, and then proceed with the c++ code in the browser test. | 21 // update it, and then proceed with the c++ code in the browser test. |
22 var properties2 = { "title": "test_item2" }; | 22 var properties2 = { "title": "test_item2" }; |
23 | 23 |
24 var id2; | 24 var id2; |
25 id2 = chrome.contextMenus.create(properties2, | 25 id2 = chrome.contextMenus.create(properties2, |
26 function() { | 26 function() { |
27 var update_properties = { "documentUrlPatterns": patterns }; | 27 var update_properties = { "documentUrlPatterns": patterns }; |
28 chrome.contextMenus.update(id2, update_properties, | 28 chrome.contextMenus.update(id2, update_properties, |
29 make_browsertest_proceed); | 29 make_browsertest_proceed); |
30 }); | 30 }); |
31 }; | 31 }; |
OLD | NEW |