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

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

Issue 8417012: Refactor loading out of ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: finally Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/extensions/extension_browsertest.h"
7 #include "chrome/browser/extensions/extension_install_ui.h" 7 #include "chrome/browser/extensions/extension_install_ui.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 public: 45 public:
46 // Installs a crx from |crx_relpath| (a path relative to the extension test 46 // Installs a crx from |crx_relpath| (a path relative to the extension test
47 // data dir) with expected id |id|. Returns whether a confirmation prompt 47 // data dir) with expected id |id|. Returns whether a confirmation prompt
48 // happened or not. 48 // happened or not.
49 bool DidWhitelistInstallPrompt(const std::string& crx_relpath, 49 bool DidWhitelistInstallPrompt(const std::string& crx_relpath,
50 const std::string& id) { 50 const std::string& id) {
51 ExtensionService* service = browser()->profile()->GetExtensionService(); 51 ExtensionService* service = browser()->profile()->GetExtensionService();
52 MockInstallUI* mock_install_ui = new MockInstallUI(browser()->profile()); 52 MockInstallUI* mock_install_ui = new MockInstallUI(browser()->profile());
53 53
54 scoped_refptr<CrxInstaller> installer( 54 scoped_refptr<CrxInstaller> installer(
55 service->MakeCrxInstaller(mock_install_ui /* ownership transferred */)); 55 CrxInstaller::Create(service,
56 mock_install_ui /* ownership transferred */));
56 57
57 installer->set_allow_silent_install(true); 58 installer->set_allow_silent_install(true);
58 installer->set_is_gallery_install(true); 59 installer->set_is_gallery_install(true);
59 CrxInstaller::SetWhitelistedInstallId(id); 60 CrxInstaller::SetWhitelistedInstallId(id);
60 61
61 FilePath crx_path = test_data_dir_.AppendASCII(crx_relpath); 62 FilePath crx_path = test_data_dir_.AppendASCII(crx_relpath);
62 installer->InstallCrx(crx_path); 63 installer->InstallCrx(crx_path);
63 ui_test_utils::RunMessageLoop(); 64 ui_test_utils::RunMessageLoop();
64 65
65 return mock_install_ui->confirmation_requested(); 66 return mock_install_ui->confirmation_requested();
66 } 67 }
67 }; 68 };
68 69
69 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) { 70 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) {
70 #if !defined(OS_CHROMEOS) 71 #if !defined(OS_CHROMEOS)
71 // An extension with NPAPI should give a prompt. 72 // An extension with NPAPI should give a prompt.
72 EXPECT_TRUE(DidWhitelistInstallPrompt("uitest/plugins.crx", 73 EXPECT_TRUE(DidWhitelistInstallPrompt("uitest/plugins.crx",
73 "hdgllgikmikobbofgnabhfimcfoopgnd")); 74 "hdgllgikmikobbofgnabhfimcfoopgnd"));
74 #endif // !defined(OS_CHROMEOS) 75 #endif // !defined(OS_CHROMEOS)
75 } 76 }
76 77
77 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, 78 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest,
78 GalleryInstallGetsExperimental) { 79 GalleryInstallGetsExperimental) {
79 InstallExtension(test_data_dir_.AppendASCII("experimental.crx"), 0); 80 InstallExtension(test_data_dir_.AppendASCII("experimental.crx"), 0);
80 InstallExtensionFromWebstore( 81 InstallExtensionFromWebstore(
81 test_data_dir_.AppendASCII("experimental.crx"), 1); 82 test_data_dir_.AppendASCII("experimental.crx"), 1);
82 } 83 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.cc ('k') | chrome/browser/extensions/extension_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698