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

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

Issue 16174003: Make all tests use GetActiveDesktop() instead of hardcoding HOST_DESKTOP_TYPE_NATIVE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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) 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/extensions/extension_context_menu_model.h" 5 #include "chrome/browser/extensions/extension_context_menu_model.h"
6 6
7 #include "chrome/browser/extensions/extension_service_unittest.h" 7 #include "chrome/browser/extensions/extension_service_unittest.h"
8 #include "chrome/browser/extensions/extension_system.h" 8 #include "chrome/browser/extensions/extension_system.h"
9 #include "chrome/browser/extensions/test_management_policy.h" 9 #include "chrome/browser/extensions/test_management_policy.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 21 matching lines...) Expand all
32 .Set("name", "Page Action Extension") 32 .Set("name", "Page Action Extension")
33 .Set("version", "1") 33 .Set("version", "1")
34 .Set("manifest_version", 2) 34 .Set("manifest_version", 2)
35 .Set("page_action", DictionaryBuilder() 35 .Set("page_action", DictionaryBuilder()
36 .Set("default_title", "Hello"))) 36 .Set("default_title", "Hello")))
37 .Build(); 37 .Build();
38 ASSERT_TRUE(extension.get()); 38 ASSERT_TRUE(extension.get());
39 service_->AddExtension(extension.get()); 39 service_->AddExtension(extension.get());
40 40
41 // Create a Browser for the ExtensionContextMenuModel to use. 41 // Create a Browser for the ExtensionContextMenuModel to use.
42 Browser::CreateParams params(profile_.get(), 42 Browser::CreateParams params(profile_.get(), chrome::GetActiveDesktop());
43 chrome::HOST_DESKTOP_TYPE_NATIVE);
44 TestBrowserWindow test_window; 43 TestBrowserWindow test_window;
45 params.window = &test_window; 44 params.window = &test_window;
46 Browser browser(params); 45 Browser browser(params);
47 46
48 scoped_refptr<ExtensionContextMenuModel> menu( 47 scoped_refptr<ExtensionContextMenuModel> menu(
49 new ExtensionContextMenuModel(extension.get(), &browser, NULL)); 48 new ExtensionContextMenuModel(extension.get(), &browser, NULL));
50 49
51 extensions::ExtensionSystem* system = 50 extensions::ExtensionSystem* system =
52 extensions::ExtensionSystem::Get(profile_.get()); 51 extensions::ExtensionSystem::Get(profile_.get());
53 system->management_policy()->UnregisterAllProviders(); 52 system->management_policy()->UnregisterAllProviders();
54 53
55 // Actions should be enabled. 54 // Actions should be enabled.
56 ASSERT_TRUE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::UNINSTALL)); 55 ASSERT_TRUE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::UNINSTALL));
57 56
58 extensions::TestManagementPolicyProvider policy_provider( 57 extensions::TestManagementPolicyProvider policy_provider(
59 extensions::TestManagementPolicyProvider::PROHIBIT_MODIFY_STATUS); 58 extensions::TestManagementPolicyProvider::PROHIBIT_MODIFY_STATUS);
60 system->management_policy()->RegisterProvider(&policy_provider); 59 system->management_policy()->RegisterProvider(&policy_provider);
61 60
62 // Now the actions are disabled. 61 // Now the actions are disabled.
63 ASSERT_FALSE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::UNINSTALL)); 62 ASSERT_FALSE(menu->IsCommandIdEnabled(ExtensionContextMenuModel::UNINSTALL));
64 63
65 // Don't leave |policy_provider| dangling. 64 // Don't leave |policy_provider| dangling.
66 system->management_policy()->UnregisterAllProviders(); 65 system->management_policy()->UnregisterAllProviders();
67 } 66 }
68 67
69 } // namespace 68 } // namespace
70 } // namespace extensions 69 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/test/test_api.cc ('k') | chrome/browser/managed_mode/managed_mode_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698