Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu_unittest.cc

Issue 7229012: Use extension match pattern syntax in content settings extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initialize port Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include <string> 5 #include <string>
6 6
7 #include "chrome/browser/tab_contents/render_view_context_menu.h" 7 #include "chrome/browser/tab_contents/render_view_context_menu.h"
8 8
9 #include "chrome/browser/extensions/extension_prefs.h" 9 #include "chrome/browser/extensions/extension_prefs.h"
10 #include "chrome/common/extensions/url_pattern.h" 10 #include "chrome/common/extensions/url_pattern.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 if (contexts & ExtensionMenuItem::FRAME) 67 if (contexts & ExtensionMenuItem::FRAME)
68 rv.frame_url = GURL("http://test.frame/"); 68 rv.frame_url = GURL("http://test.frame/");
69 69
70 return rv; 70 return rv;
71 } 71 }
72 72
73 // Generates a URLPatternSet with a single pattern 73 // Generates a URLPatternSet with a single pattern
74 static URLPatternSet CreatePatternSet(const std::string& pattern) { 74 static URLPatternSet CreatePatternSet(const std::string& pattern) {
75 URLPattern target(URLPattern::SCHEME_HTTP); 75 URLPattern target(URLPattern::SCHEME_HTTP);
76 target.Parse(pattern, URLPattern::PARSE_LENIENT); 76 target.Parse(pattern, URLPattern::IGNORE_PORTS);
77 77
78 URLPatternSet rv; 78 URLPatternSet rv;
79 rv.AddPattern(target); 79 rv.AddPattern(target);
80 80
81 return rv; 81 return rv;
82 } 82 }
83 83
84 TEST_F(RenderViewContextMenuTest, TargetIgnoredForPage) { 84 TEST_F(RenderViewContextMenuTest, TargetIgnoredForPage) {
85 ContextMenuParams params = CreateParams(0); 85 ContextMenuParams params = CreateParams(0);
86 86
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 ExtensionMenuItem::ContextList contexts; 232 ExtensionMenuItem::ContextList contexts;
233 contexts.Add(ExtensionMenuItem::SELECTION); 233 contexts.Add(ExtensionMenuItem::SELECTION);
234 contexts.Add(ExtensionMenuItem::IMAGE); 234 contexts.Add(ExtensionMenuItem::IMAGE);
235 235
236 URLPatternSet patterns = CreatePatternSet("*://test.none/*"); 236 URLPatternSet patterns = CreatePatternSet("*://test.none/*");
237 237
238 EXPECT_TRUE(ExtensionContextAndPatternMatch(params, contexts, patterns)); 238 EXPECT_TRUE(ExtensionContextAndPatternMatch(params, contexts, patterns));
239 } 239 }
240 240
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698