| 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 static void SetUpTestCase() { |
| 246 // Checking for incognito availability requires platform parental controls |
| 247 // initialization. |
| 248 IncognitoModePrefs::InitializePlatformParentalControls(); |
| 249 } |
| 250 |
| 251 static void TearDownTestCase() { |
| 252 IncognitoModePrefs::UninitializePlatformParentalControls(); |
| 253 } |
| 254 |
| 245 void SetUp() override { | 255 void SetUp() override { |
| 246 ChromeRenderViewHostTestHarness::SetUp(); | 256 ChromeRenderViewHostTestHarness::SetUp(); |
| 247 registry_.reset(new ProtocolHandlerRegistry(profile(), NULL)); | 257 registry_.reset(new ProtocolHandlerRegistry(profile(), NULL)); |
| 248 } | 258 } |
| 249 | 259 |
| 250 void TearDown() override { | 260 void TearDown() override { |
| 251 registry_.reset(); | 261 registry_.reset(); |
| 252 ChromeRenderViewHostTestHarness::TearDown(); | 262 ChromeRenderViewHostTestHarness::TearDown(); |
| 253 } | 263 } |
| 254 | 264 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 301 } |
| 292 | 302 |
| 293 // Make sure the checking custom command id that is not enabled will not | 303 // Make sure the checking custom command id that is not enabled will not |
| 294 // cause DCHECK failure. | 304 // cause DCHECK failure. |
| 295 TEST_F(RenderViewContextMenuPrefsTest, | 305 TEST_F(RenderViewContextMenuPrefsTest, |
| 296 IsCustomCommandIdEnabled) { | 306 IsCustomCommandIdEnabled) { |
| 297 scoped_ptr<TestRenderViewContextMenu> menu(CreateContextMenu()); | 307 scoped_ptr<TestRenderViewContextMenu> menu(CreateContextMenu()); |
| 298 | 308 |
| 299 EXPECT_FALSE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_CUSTOM_FIRST)); | 309 EXPECT_FALSE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_CUSTOM_FIRST)); |
| 300 } | 310 } |
| OLD | NEW |