diff options
author | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 23:00:54 +0000 |
---|---|---|
committer | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 23:00:54 +0000 |
commit | 5ae8af554ab5798727ee93f60e75f4f00597037d (patch) | |
tree | c3f94d3a4a5e6612212acb1e6e910e2a0db682d9 /chrome/test | |
parent | 6a17467a434ffa87510c656988d5bd604625ed5f (diff) | |
download | chromium_src-5ae8af554ab5798727ee93f60e75f4f00597037d.zip chromium_src-5ae8af554ab5798727ee93f60e75f4f00597037d.tar.gz chromium_src-5ae8af554ab5798727ee93f60e75f4f00597037d.tar.bz2 |
Specifying "targetUrlPatterns" should imply link context.
When creating a context menu item from an extension, specifying one or more
patterns in the "targetUrlPatterns" should imply that your item only appears
on items with a matching link, and not in contexts that have no link (which
does not match, sort of by definition :) ).
BUG=49739
TEST=Follow steps in bug report.
Review URL: http://codereview.chromium.org/3420009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59986 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
4 files changed, 25 insertions, 8 deletions
diff --git a/chrome/test/data/extensions/context_menus/patterns/test.js b/chrome/test/data/extensions/context_menus/patterns/test.js index 4777a86..ef9bd45 100644 --- a/chrome/test/data/extensions/context_menus/patterns/test.js +++ b/chrome/test/data/extensions/context_menus/patterns/test.js @@ -11,23 +11,20 @@ var make_browsertest_proceed = function() { var patterns = ["http://*.google.com/*", "https://*.google.com/*"]; window.onload = function() { - // Create one item that does have a documentUrlPattern and targetUrlPattern. + // Create one item that does have a documentUrlPattern. var properties1 = { - "title": "test_item1", "documentUrlPatterns": patterns, - "targetUrlPatterns": patterns + "title": "test_item1", "documentUrlPatterns": patterns }; chrome.contextMenus.create(properties1); - // Create an item that initially doesn't have a documentUrlPattern and - // targetUrlPattern, then update it, and trigger the rest of the c++ code in - // the browser test by navigating the tab. + // Create an item that initially doesn't have a documentUrlPattern, then + // update it, and then proceed with the c++ code in the browser test. var properties2 = { "title": "test_item2" }; var id2; id2 = chrome.contextMenus.create(properties2, function() { - var update_properties = { "documentUrlPatterns": patterns, - "targetUrlPatterns": patterns }; + var update_properties = { "documentUrlPatterns": patterns }; chrome.contextMenus.update(id2, update_properties, make_browsertest_proceed); }); diff --git a/chrome/test/data/extensions/context_menus/target_urls/background.html b/chrome/test/data/extensions/context_menus/target_urls/background.html new file mode 100644 index 0000000..46f4d74 --- /dev/null +++ b/chrome/test/data/extensions/context_menus/target_urls/background.html @@ -0,0 +1 @@ +<script src="test.js"></script> diff --git a/chrome/test/data/extensions/context_menus/target_urls/manifest.json b/chrome/test/data/extensions/context_menus/target_urls/manifest.json new file mode 100644 index 0000000..8061f29 --- /dev/null +++ b/chrome/test/data/extensions/context_menus/target_urls/manifest.json @@ -0,0 +1,6 @@ +{ + "name" : "targetUrlPatterns test", + "version" : "0.1", + "permissions": [ "contextMenus", "tabs" ], + "background_page": "background.html" +} diff --git a/chrome/test/data/extensions/context_menus/target_urls/test.js b/chrome/test/data/extensions/context_menus/target_urls/test.js new file mode 100644 index 0000000..e32099f --- /dev/null +++ b/chrome/test/data/extensions/context_menus/target_urls/test.js @@ -0,0 +1,13 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +window.onload = function() { + var patterns = [ "http://*.google.com/*" ]; + chrome.contextMenus.create({"title":"item1", "contexts": ["all"], + "targetUrlPatterns": patterns}, function() { + if (!chrome.extension.lastError) { + chrome.test.sendMessage("created items"); + } + }); +}; |