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

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

Issue 264763002: Support remote installation of extensions and apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add a first test, fix a bug Created 6 years, 7 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 "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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 strict_manifest_checks); 158 strict_manifest_checks);
159 } 159 }
160 160
161 void RunCrxInstaller(const WebstoreInstaller::Approval* approval, 161 void RunCrxInstaller(const WebstoreInstaller::Approval* approval,
162 scoped_ptr<ExtensionInstallPrompt> prompt, 162 scoped_ptr<ExtensionInstallPrompt> prompt,
163 const base::FilePath& crx_path) { 163 const base::FilePath& crx_path) {
164 ExtensionService* service = extensions::ExtensionSystem::Get( 164 ExtensionService* service = extensions::ExtensionSystem::Get(
165 browser()->profile())->extension_service(); 165 browser()->profile())->extension_service();
166 scoped_refptr<CrxInstaller> installer( 166 scoped_refptr<CrxInstaller> installer(
167 CrxInstaller::Create(service, prompt.Pass(), approval)); 167 CrxInstaller::Create(service, prompt.Pass(), approval));
168 installer->set_allow_silent_install(true); 168 installer->set_allow_silent_install(CrxInstaller::GRANT_SILENTLY);
169 installer->set_is_gallery_install(true); 169 installer->set_is_gallery_install(true);
170 installer->InstallCrx(crx_path); 170 installer->InstallCrx(crx_path);
171 content::RunMessageLoop(); 171 content::RunMessageLoop();
172 } 172 }
173 173
174 // Installs a crx from |crx_relpath| (a path relative to the extension test 174 // Installs a crx from |crx_relpath| (a path relative to the extension test
175 // data dir) with expected id |id|. 175 // data dir) with expected id |id|.
176 void InstallWithPrompt(const char* ext_relpath, 176 void InstallWithPrompt(const char* ext_relpath,
177 const std::string& id, 177 const std::string& id,
178 scoped_refptr<MockPromptProxy> mock_install_prompt) { 178 scoped_refptr<MockPromptProxy> mock_install_prompt) {
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 chromeos::FakeUserManager* fake_user_manager = 488 chromeos::FakeUserManager* fake_user_manager =
489 new chromeos::FakeUserManager(); 489 new chromeos::FakeUserManager();
490 fake_user_manager->AddKioskAppUser("example@example.com"); 490 fake_user_manager->AddKioskAppUser("example@example.com");
491 fake_user_manager->LoginUser("example@example.com"); 491 fake_user_manager->LoginUser("example@example.com");
492 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager); 492 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager);
493 EXPECT_TRUE(InstallExtension(crx_path, 1)); 493 EXPECT_TRUE(InstallExtension(crx_path, 1));
494 #endif 494 #endif
495 } 495 }
496 496
497 } // namespace extensions 497 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698