| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 10 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 10 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 contexts.Add(MenuItem::SELECTION); | 235 contexts.Add(MenuItem::SELECTION); |
| 236 contexts.Add(MenuItem::IMAGE); | 236 contexts.Add(MenuItem::IMAGE); |
| 237 | 237 |
| 238 URLPatternSet patterns = CreatePatternSet("*://test.none/*"); | 238 URLPatternSet patterns = CreatePatternSet("*://test.none/*"); |
| 239 | 239 |
| 240 EXPECT_TRUE(ExtensionContextAndPatternMatch(params, contexts, patterns)); | 240 EXPECT_TRUE(ExtensionContextAndPatternMatch(params, contexts, patterns)); |
| 241 } | 241 } |
| 242 | 242 |
| 243 class RenderViewContextMenuPrefsTest : public ChromeRenderViewHostTestHarness { | 243 class RenderViewContextMenuPrefsTest : public ChromeRenderViewHostTestHarness { |
| 244 public: | 244 public: |
| 245 virtual void SetUp() override { | 245 void SetUp() override { |
| 246 ChromeRenderViewHostTestHarness::SetUp(); | 246 ChromeRenderViewHostTestHarness::SetUp(); |
| 247 registry_.reset(new ProtocolHandlerRegistry(profile(), NULL)); | 247 registry_.reset(new ProtocolHandlerRegistry(profile(), NULL)); |
| 248 } | 248 } |
| 249 | 249 |
| 250 virtual void TearDown() override { | 250 void TearDown() override { |
| 251 registry_.reset(); | 251 registry_.reset(); |
| 252 ChromeRenderViewHostTestHarness::TearDown(); | 252 ChromeRenderViewHostTestHarness::TearDown(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 TestRenderViewContextMenu* CreateContextMenu() { | 255 TestRenderViewContextMenu* CreateContextMenu() { |
| 256 content::ContextMenuParams params = CreateParams(MenuItem::LINK); | 256 content::ContextMenuParams params = CreateParams(MenuItem::LINK); |
| 257 params.unfiltered_link_url = params.link_url; | 257 params.unfiltered_link_url = params.link_url; |
| 258 content::WebContents* wc = web_contents(); | 258 content::WebContents* wc = web_contents(); |
| 259 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( | 259 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( |
| 260 wc->GetMainFrame(), params); | 260 wc->GetMainFrame(), params); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 // Make sure the checking custom command id that is not enabled will not | 293 // Make sure the checking custom command id that is not enabled will not |
| 294 // cause DCHECK failure. | 294 // cause DCHECK failure. |
| 295 TEST_F(RenderViewContextMenuPrefsTest, | 295 TEST_F(RenderViewContextMenuPrefsTest, |
| 296 IsCustomCommandIdEnabled) { | 296 IsCustomCommandIdEnabled) { |
| 297 scoped_ptr<TestRenderViewContextMenu> menu(CreateContextMenu()); | 297 scoped_ptr<TestRenderViewContextMenu> menu(CreateContextMenu()); |
| 298 | 298 |
| 299 EXPECT_FALSE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_CUSTOM_FIRST)); | 299 EXPECT_FALSE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_CUSTOM_FIRST)); |
| 300 } | 300 } |
| OLD | NEW |