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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "chrome/browser/download/download_crx_util.h" | 6 #include "chrome/browser/download/download_crx_util.h" |
7 #include "chrome/browser/extensions/browser_action_test_util.h" | 7 #include "chrome/browser/extensions/browser_action_test_util.h" |
8 #include "chrome/browser/extensions/crx_installer.h" | 8 #include "chrome/browser/extensions/crx_installer.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 EXPECT_TRUE(mock_install_prompt->did_succeed()); | 190 EXPECT_TRUE(mock_install_prompt->did_succeed()); |
191 } | 191 } |
192 | 192 |
193 // Installs an extension and checks that it has scopes granted IFF | 193 // Installs an extension and checks that it has scopes granted IFF |
194 // |record_oauth2_grant| is true. | 194 // |record_oauth2_grant| is true. |
195 void CheckHasEmptyScopesAfterInstall(const std::string& ext_relpath, | 195 void CheckHasEmptyScopesAfterInstall(const std::string& ext_relpath, |
196 bool record_oauth2_grant) { | 196 bool record_oauth2_grant) { |
197 CommandLine::ForCurrentProcess()->AppendSwitch( | 197 CommandLine::ForCurrentProcess()->AppendSwitch( |
198 switches::kEnableExperimentalExtensionApis); | 198 switches::kEnableExperimentalExtensionApis); |
199 | 199 |
200 ExtensionService* service = extensions::ExtensionSystem::Get( | |
201 browser()->profile())->extension_service(); | |
202 | |
203 scoped_refptr<MockPromptProxy> mock_prompt = | 200 scoped_refptr<MockPromptProxy> mock_prompt = |
204 CreateMockPromptProxyForBrowser(browser()); | 201 CreateMockPromptProxyForBrowser(browser()); |
205 | 202 |
206 mock_prompt->set_record_oauth2_grant(record_oauth2_grant); | 203 mock_prompt->set_record_oauth2_grant(record_oauth2_grant); |
207 InstallWithPrompt("browsertest/scopes", std::string(), mock_prompt); | 204 InstallWithPrompt("browsertest/scopes", std::string(), mock_prompt); |
208 | 205 |
209 scoped_refptr<PermissionSet> permissions = | 206 scoped_refptr<PermissionSet> permissions = |
210 service->extension_prefs()->GetGrantedPermissions( | 207 ExtensionPrefs::Get(browser()->profile())->GetGrantedPermissions( |
211 mock_prompt->extension_id()); | 208 mock_prompt->extension_id()); |
212 ASSERT_TRUE(permissions.get()); | 209 ASSERT_TRUE(permissions.get()); |
213 } | 210 } |
214 }; | 211 }; |
215 | 212 |
216 #if defined(OS_CHROMEOS) | 213 #if defined(OS_CHROMEOS) |
217 #define MAYBE_Whitelisting DISABLED_Whitelisting | 214 #define MAYBE_Whitelisting DISABLED_Whitelisting |
218 #else | 215 #else |
219 #define MAYBE_Whitelisting Whitelisting | 216 #define MAYBE_Whitelisting Whitelisting |
220 #endif | 217 #endif |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 chromeos::FakeUserManager* fake_user_manager = | 488 chromeos::FakeUserManager* fake_user_manager = |
492 new chromeos::FakeUserManager(); | 489 new chromeos::FakeUserManager(); |
493 fake_user_manager->AddKioskAppUser("example@example.com"); | 490 fake_user_manager->AddKioskAppUser("example@example.com"); |
494 fake_user_manager->LoginUser("example@example.com"); | 491 fake_user_manager->LoginUser("example@example.com"); |
495 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager); | 492 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager); |
496 EXPECT_TRUE(InstallExtension(crx_path, 1)); | 493 EXPECT_TRUE(InstallExtension(crx_path, 1)); |
497 #endif | 494 #endif |
498 } | 495 } |
499 | 496 |
500 } // namespace extensions | 497 } // namespace extensions |
OLD | NEW |