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 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_prefs.h" | 7 #include "chrome/browser/extensions/extension_prefs.h" |
8 #include "extensions/common/url_pattern.h" | 8 #include "extensions/common/url_pattern.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
12 | 12 |
13 using extensions::MenuItem; | 13 using extensions::MenuItem; |
| 14 using extensions::URLPatternSet; |
14 | 15 |
15 class RenderViewContextMenuTest : public testing::Test { | 16 class RenderViewContextMenuTest : public testing::Test { |
16 public: | 17 public: |
17 RenderViewContextMenuTest() { } | 18 RenderViewContextMenuTest() { } |
18 | 19 |
19 protected: | 20 protected: |
20 // Proxy defined here to minimize friend classes in RenderViewContextMenu | 21 // Proxy defined here to minimize friend classes in RenderViewContextMenu |
21 static bool ExtensionContextAndPatternMatch( | 22 static bool ExtensionContextAndPatternMatch( |
22 const content::ContextMenuParams& params, | 23 const content::ContextMenuParams& params, |
23 MenuItem::ContextList contexts, | 24 MenuItem::ContextList contexts, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 MenuItem::SELECTION | MenuItem::IMAGE); | 230 MenuItem::SELECTION | MenuItem::IMAGE); |
230 | 231 |
231 MenuItem::ContextList contexts; | 232 MenuItem::ContextList contexts; |
232 contexts.Add(MenuItem::SELECTION); | 233 contexts.Add(MenuItem::SELECTION); |
233 contexts.Add(MenuItem::IMAGE); | 234 contexts.Add(MenuItem::IMAGE); |
234 | 235 |
235 URLPatternSet patterns = CreatePatternSet("*://test.none/*"); | 236 URLPatternSet patterns = CreatePatternSet("*://test.none/*"); |
236 | 237 |
237 EXPECT_TRUE(ExtensionContextAndPatternMatch(params, contexts, patterns)); | 238 EXPECT_TRUE(ExtensionContextAndPatternMatch(params, contexts, patterns)); |
238 } | 239 } |
OLD | NEW |