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

Side by Side Diff: chrome/browser/extensions/extension_context_menu_browsertest.cc

Issue 10626007: Move ExtensionSystem into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Master merge; moved class declaration Created 8 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
OLDNEW
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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/extensions/extension_browsertest.h" 7 #include "chrome/browser/extensions/extension_browsertest.h"
8 #include "chrome/browser/extensions/extension_context_menu_model.h" 8 #include "chrome/browser/extensions/extension_context_menu_model.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_system.h" 10 #include "chrome/browser/extensions/extension_system.h"
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 527
528 // We need an extension to pass to the menu constructor, but we don't care 528 // We need an extension to pass to the menu constructor, but we don't care
529 // which one. 529 // which one.
530 ExtensionSet::const_iterator i = service->extensions()->begin(); 530 ExtensionSet::const_iterator i = service->extensions()->begin();
531 const extensions::Extension* extension = *i; 531 const extensions::Extension* extension = *i;
532 ASSERT_TRUE(extension != NULL); 532 ASSERT_TRUE(extension != NULL);
533 533
534 scoped_refptr<ExtensionContextMenuModel> menu( 534 scoped_refptr<ExtensionContextMenuModel> menu(
535 new ExtensionContextMenuModel(extension, browser(), NULL)); 535 new ExtensionContextMenuModel(extension, browser(), NULL));
536 536
537 ExtensionSystem::Get( 537 extensions::ExtensionSystem::Get(
538 browser()->profile())->management_policy()->UnregisterAllProviders(); 538 browser()->profile())->management_policy()->UnregisterAllProviders();
539 539
540 // Actions should be enabled. 540 // Actions should be enabled.
541 ASSERT_TRUE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::DISABLE)); 541 ASSERT_TRUE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::DISABLE));
542 ASSERT_TRUE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::UNINSTALL)); 542 ASSERT_TRUE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::UNINSTALL));
543 543
544 extensions::TestManagementPolicyProvider policy_provider( 544 extensions::TestManagementPolicyProvider policy_provider(
545 extensions::TestManagementPolicyProvider::PROHIBIT_MODIFY_STATUS); 545 extensions::TestManagementPolicyProvider::PROHIBIT_MODIFY_STATUS);
546 ExtensionSystem::Get( 546 extensions::ExtensionSystem::Get(
547 browser()->profile())->management_policy()->RegisterProvider( 547 browser()->profile())->management_policy()->RegisterProvider(
548 &policy_provider); 548 &policy_provider);
549 549
550 // Now the actions are disabled. 550 // Now the actions are disabled.
551 ASSERT_FALSE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::DISABLE)); 551 ASSERT_FALSE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::DISABLE));
552 ASSERT_FALSE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::UNINSTALL)); 552 ASSERT_FALSE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::UNINSTALL));
553 } 553 }
554 554
555 class ExtensionContextMenuBrowserLazyTest : 555 class ExtensionContextMenuBrowserLazyTest :
556 public ExtensionContextMenuBrowserTest { 556 public ExtensionContextMenuBrowserTest {
(...skipping 30 matching lines...) Expand all
587 EXPECT_FALSE(menu->IsCommandIdChecked(command_id)); 587 EXPECT_FALSE(menu->IsCommandIdChecked(command_id));
588 588
589 // Executing the checkbox also fires the onClicked event. 589 // Executing the checkbox also fires the onClicked event.
590 ExtensionTestMessageListener listener("onClicked fired for checkbox1", false); 590 ExtensionTestMessageListener listener("onClicked fired for checkbox1", false);
591 menu->ExecuteCommand(command_id); 591 menu->ExecuteCommand(command_id);
592 checkbox_checked.WaitUntilClosed(); 592 checkbox_checked.WaitUntilClosed();
593 593
594 EXPECT_TRUE(menu->IsCommandIdChecked(command_id)); 594 EXPECT_TRUE(menu->IsCommandIdChecked(command_id));
595 ASSERT_TRUE(listener.WaitUntilSatisfied()); 595 ASSERT_TRUE(listener.WaitUntilSatisfied());
596 } 596 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.cc ('k') | chrome/browser/extensions/extension_context_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698