[email protected] | 3538533 | 2012-03-28 02:32:03 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 5 | #include "chrome/browser/download/download_crx_util.h" |
| 6 | #include "chrome/browser/download/download_service.h" |
| 7 | #include "chrome/browser/download/download_service_factory.h" |
| 8 | #include "chrome/browser/download/download_test_observer.h" |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 9 | #include "chrome/browser/extensions/crx_installer.h" |
| 10 | #include "chrome/browser/extensions/extension_browsertest.h" |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 11 | #include "chrome/browser/extensions/extension_install_prompt.h" |
[email protected] | eaa7dd18 | 2010-12-14 11:09:00 | [diff] [blame] | 12 | #include "chrome/browser/extensions/extension_service.h" |
[email protected] | 8ecad5e | 2010-12-02 21:18:33 | [diff] [blame] | 13 | #include "chrome/browser/profiles/profile.h" |
[email protected] | 2ad4a90 | 2010-11-17 06:05:13 | [diff] [blame] | 14 | #include "chrome/browser/ui/browser.h" |
[email protected] | 619f8618 | 2012-07-03 21:30:18 | [diff] [blame] | 15 | #include "chrome/browser/ui/browser_window.h" |
[email protected] | 240cc92a | 2011-12-01 01:22:24 | [diff] [blame] | 16 | #include "chrome/common/chrome_switches.h" |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 17 | #include "chrome/common/extensions/extension.h" |
[email protected] | 3538533 | 2012-03-28 02:32:03 | [diff] [blame] | 18 | #include "chrome/common/extensions/extension_file_util.h" |
[email protected] | 89019d6 | 2012-05-17 18:47:09 | [diff] [blame] | 19 | #include "chrome/common/extensions/extension_switch_utils.h" |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 20 | #include "chrome/common/extensions/permissions/permission_set.h" |
[email protected] | af44e7fb | 2011-07-29 18:32:32 | [diff] [blame] | 21 | #include "chrome/test/base/ui_test_utils.h" |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 22 | #include "grit/generated_resources.h" |
| 23 | #include "ui/base/l10n/l10n_util.h" |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 24 | |
[email protected] | 7a5452f | 2010-12-13 23:03:19 | [diff] [blame] | 25 | class SkBitmap; |
| 26 | |
[email protected] | bf3d9df | 2012-07-24 23:20:27 | [diff] [blame^] | 27 | namespace extensions { |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 28 | |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 29 | namespace { |
| 30 | |
[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 31 | // Observer waits for exactly one download to finish. |
| 32 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 33 | class MockInstallPrompt : public ExtensionInstallPrompt { |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 34 | public: |
[email protected] | 619f8618 | 2012-07-03 21:30:18 | [diff] [blame] | 35 | explicit MockInstallPrompt(gfx::NativeWindow parent, |
| 36 | content::PageNavigator* navigator, |
| 37 | Profile* profile) : |
| 38 | ExtensionInstallPrompt(parent, navigator, profile), |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 39 | confirmation_requested_(false), |
| 40 | extension_(NULL) {} |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 41 | |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 42 | bool did_succeed() const { return !!extension_; } |
| 43 | const Extension* extension() const { return extension_; } |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 44 | bool confirmation_requested() const { return confirmation_requested_; } |
| 45 | const string16& error() const { return error_; } |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 46 | void set_record_oauth2_grant(bool record) { record_oauth2_grant_ = record; } |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 47 | |
| 48 | // Overriding some of the ExtensionInstallUI API. |
[email protected] | 1c321ee | 2012-05-21 03:02:34 | [diff] [blame] | 49 | void ConfirmInstall(Delegate* delegate, |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 50 | const Extension* extension) { |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 51 | confirmation_requested_ = true; |
| 52 | delegate->InstallUIProceed(); |
| 53 | } |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 54 | void OnInstallSuccess(const Extension* extension, |
[email protected] | 1c321ee | 2012-05-21 03:02:34 | [diff] [blame] | 55 | SkBitmap* icon) { |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 56 | extension_ = extension; |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 57 | MessageLoopForUI::current()->Quit(); |
| 58 | } |
[email protected] | 4eaf0b3 | 2012-06-19 06:33:28 | [diff] [blame] | 59 | void OnInstallFailure(const CrxInstallerError& error) { |
| 60 | error_ = error.message(); |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 61 | MessageLoopForUI::current()->Quit(); |
| 62 | } |
| 63 | |
| 64 | private: |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 65 | bool confirmation_requested_; |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 66 | string16 error_; |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 67 | const Extension* extension_; |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 68 | }; |
| 69 | |
[email protected] | 619f8618 | 2012-07-03 21:30:18 | [diff] [blame] | 70 | MockInstallPrompt* CreateMockInstallPromptForBrowser(Browser* browser) { |
| 71 | gfx::NativeWindow parent = |
| 72 | browser->window() ? browser->window()->GetNativeWindow() : NULL; |
| 73 | return new MockInstallPrompt(parent, browser, browser->profile()); |
| 74 | } |
| 75 | |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 76 | } // namespace |
| 77 | |
| 78 | class ExtensionCrxInstallerTest : public ExtensionBrowserTest { |
| 79 | public: |
| 80 | // Installs a crx from |crx_relpath| (a path relative to the extension test |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 81 | // data dir) with expected id |id|. Returns the installer. |
| 82 | scoped_refptr<CrxInstaller> InstallWithPrompt( |
| 83 | const std::string& ext_relpath, |
| 84 | const std::string& id, |
| 85 | MockInstallPrompt* mock_install_prompt) { |
[email protected] | eaa7dd18 | 2010-12-14 11:09:00 | [diff] [blame] | 86 | ExtensionService* service = browser()->profile()->GetExtensionService(); |
[email protected] | 3538533 | 2012-03-28 02:32:03 | [diff] [blame] | 87 | FilePath ext_path = test_data_dir_.AppendASCII(ext_relpath); |
| 88 | |
| 89 | std::string error; |
| 90 | base::DictionaryValue* parsed_manifest = |
| 91 | extension_file_util::LoadManifest(ext_path, &error); |
| 92 | if (!parsed_manifest) |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 93 | return scoped_refptr<CrxInstaller>(); |
[email protected] | 3538533 | 2012-03-28 02:32:03 | [diff] [blame] | 94 | |
[email protected] | bf3d9df | 2012-07-24 23:20:27 | [diff] [blame^] | 95 | scoped_ptr<WebstoreInstaller::Approval> approval; |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 96 | if (!id.empty()) { |
[email protected] | bf3d9df | 2012-07-24 23:20:27 | [diff] [blame^] | 97 | approval = WebstoreInstaller::Approval::CreateWithNoInstallPrompt( |
| 98 | browser()->profile(), |
| 99 | id, |
| 100 | scoped_ptr<base::DictionaryValue>(parsed_manifest)); |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 101 | } |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 102 | |
| 103 | scoped_refptr<CrxInstaller> installer( |
[email protected] | d8c8f25f | 2011-11-02 18:18:01 | [diff] [blame] | 104 | CrxInstaller::Create(service, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 105 | mock_install_prompt, /* ownership transferred */ |
| 106 | approval.get() /* keep ownership */)); |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 107 | installer->set_allow_silent_install(true); |
[email protected] | b1f04cc | 2010-11-10 22:59:30 | [diff] [blame] | 108 | installer->set_is_gallery_install(true); |
[email protected] | 3538533 | 2012-03-28 02:32:03 | [diff] [blame] | 109 | installer->InstallCrx(PackExtension(ext_path)); |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 110 | ui_test_utils::RunMessageLoop(); |
| 111 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 112 | EXPECT_TRUE(mock_install_prompt->did_succeed()); |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 113 | return installer; |
| 114 | } |
| 115 | |
| 116 | // Installs an extension and checks that it has scopes granted IFF |
| 117 | // |record_oauth2_grant| is true. |
| 118 | void CheckHasEmptyScopesAfterInstall(const std::string& ext_relpath, |
| 119 | bool record_oauth2_grant) { |
| 120 | CommandLine::ForCurrentProcess()->AppendSwitch( |
| 121 | switches::kEnableExperimentalExtensionApis); |
| 122 | |
| 123 | ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 124 | |
[email protected] | 619f8618 | 2012-07-03 21:30:18 | [diff] [blame] | 125 | MockInstallPrompt* mock_prompt = |
| 126 | CreateMockInstallPromptForBrowser(browser()); |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 127 | mock_prompt->set_record_oauth2_grant(record_oauth2_grant); |
| 128 | scoped_refptr<CrxInstaller> installer = |
| 129 | InstallWithPrompt("browsertest/scopes", std::string(), mock_prompt); |
| 130 | |
[email protected] | bf3d9df | 2012-07-24 23:20:27 | [diff] [blame^] | 131 | scoped_refptr<PermissionSet> permissions = |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 132 | service->extension_prefs()->GetGrantedPermissions( |
| 133 | mock_prompt->extension()->id()); |
| 134 | ASSERT_TRUE(permissions.get()); |
[email protected] | d4a37f1c | 2012-07-09 21:36:13 | [diff] [blame] | 135 | EXPECT_EQ(record_oauth2_grant, installer->record_oauth2_grant_); |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 136 | } |
| 137 | }; |
| 138 | |
[email protected] | 45dd1b480 | 2012-06-05 23:07:59 | [diff] [blame] | 139 | #if defined(OS_CHROMEOS) |
| 140 | #define MAYBE_Whitelisting DISABLED_Whitelisting |
| 141 | #else |
| 142 | #define MAYBE_Whitelisting Whitelisting |
| 143 | #endif |
| 144 | IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, MAYBE_Whitelisting) { |
[email protected] | 21a5ad6 | 2012-04-03 04:48:45 | [diff] [blame] | 145 | std::string id = "hdgllgikmikobbofgnabhfimcfoopgnd"; |
| 146 | ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 147 | |
| 148 | // Even whitelisted extensions with NPAPI should not prompt. |
[email protected] | 619f8618 | 2012-07-03 21:30:18 | [diff] [blame] | 149 | MockInstallPrompt* mock_prompt = |
| 150 | CreateMockInstallPromptForBrowser(browser()); |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 151 | scoped_refptr<CrxInstaller> installer = |
| 152 | InstallWithPrompt("uitest/plugins", id, mock_prompt); |
| 153 | EXPECT_FALSE(mock_prompt->confirmation_requested()); |
[email protected] | 21a5ad6 | 2012-04-03 04:48:45 | [diff] [blame] | 154 | EXPECT_TRUE(service->GetExtensionById(id, false)); |
[email protected] | a01e0063 | 2010-11-05 16:58:14 | [diff] [blame] | 155 | } |
[email protected] | fc38935a | 2011-10-31 23:53:28 | [diff] [blame] | 156 | |
| 157 | IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, |
[email protected] | 240cc92a | 2011-12-01 01:22:24 | [diff] [blame] | 158 | GalleryInstallGetsExperimental) { |
| 159 | // We must modify the command line temporarily in order to pack an extension |
| 160 | // that requests the experimental permission. |
| 161 | CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 162 | CommandLine old_command_line = *command_line; |
| 163 | command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 164 | FilePath crx_path = PackExtension( |
| 165 | test_data_dir_.AppendASCII("experimental")); |
| 166 | ASSERT_FALSE(crx_path.empty()); |
| 167 | |
| 168 | // Now reset the command line so that we are testing specifically whether |
| 169 | // installing from webstore enables experimental permissions. |
| 170 | *(CommandLine::ForCurrentProcess()) = old_command_line; |
| 171 | |
| 172 | EXPECT_FALSE(InstallExtension(crx_path, 0)); |
| 173 | EXPECT_TRUE(InstallExtensionFromWebstore(crx_path, 1)); |
[email protected] | fc38935a | 2011-10-31 23:53:28 | [diff] [blame] | 174 | } |
[email protected] | ee14cad | 2012-03-29 01:59:37 | [diff] [blame] | 175 | |
| 176 | IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, PlatformAppCrx) { |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 177 | CommandLine::ForCurrentProcess()->AppendSwitch( |
| 178 | switches::kEnableExperimentalExtensionApis); |
[email protected] | ee14cad | 2012-03-29 01:59:37 | [diff] [blame] | 179 | EXPECT_TRUE(InstallExtension( |
[email protected] | dc37b00 | 2012-04-23 23:02:26 | [diff] [blame] | 180 | test_data_dir_.AppendASCII("minimal_platform_app.crx"), 1)); |
[email protected] | ee14cad | 2012-03-29 01:59:37 | [diff] [blame] | 181 | } |
[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 182 | |
[email protected] | 3f3365c6 | 2012-07-09 19:13:21 | [diff] [blame] | 183 | // http://crbug.com/136397 |
| 184 | #if defined(OS_CHROMEOS) |
| 185 | #define MAYBE_PackAndInstallExtension DISABLED_PackAndInstallExtension |
| 186 | #else |
| 187 | #define MAYBE_PackAndInstallExtension PackAndInstallExtension |
| 188 | #endif |
| 189 | IN_PROC_BROWSER_TEST_F( |
| 190 | ExtensionCrxInstallerTest, MAYBE_PackAndInstallExtension) { |
[email protected] | bf3d9df | 2012-07-24 23:20:27 | [diff] [blame^] | 191 | if (!switch_utils::IsEasyOffStoreInstallEnabled()) |
[email protected] | 89019d6 | 2012-05-17 18:47:09 | [diff] [blame] | 192 | return; |
| 193 | |
[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 194 | const int kNumDownloadsExpected = 1; |
| 195 | const bool kExpectFileSelectDialog = false; |
| 196 | |
| 197 | LOG(ERROR) << "PackAndInstallExtension: Packing extension"; |
| 198 | FilePath crx_path = PackExtension( |
| 199 | test_data_dir_.AppendASCII("common/background_page")); |
| 200 | ASSERT_FALSE(crx_path.empty()); |
| 201 | std::string crx_path_string(crx_path.value().begin(), crx_path.value().end()); |
| 202 | GURL url = GURL(std::string("file:///").append(crx_path_string)); |
| 203 | |
[email protected] | 619f8618 | 2012-07-03 21:30:18 | [diff] [blame] | 204 | MockInstallPrompt* mock_prompt = |
| 205 | CreateMockInstallPromptForBrowser(browser()); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 206 | download_crx_util::SetMockInstallPromptForTesting(mock_prompt); |
[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 207 | |
| 208 | LOG(ERROR) << "PackAndInstallExtension: Getting download manager"; |
| 209 | content::DownloadManager* download_manager = |
[email protected] | b441a849 | 2012-06-06 14:55:57 | [diff] [blame] | 210 | content::BrowserContext::GetDownloadManager(browser()->profile()); |
[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 211 | |
| 212 | LOG(ERROR) << "PackAndInstallExtension: Setting observer"; |
| 213 | scoped_ptr<DownloadTestObserver> observer( |
| 214 | new DownloadTestObserverTerminal( |
| 215 | download_manager, kNumDownloadsExpected, kExpectFileSelectDialog, |
| 216 | DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); |
| 217 | LOG(ERROR) << "PackAndInstallExtension: Navigating to URL"; |
| 218 | ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, |
| 219 | ui_test_utils::BROWSER_TEST_NONE); |
| 220 | |
[email protected] | 8c6af5b | 2012-06-15 20:10:26 | [diff] [blame] | 221 | EXPECT_TRUE(WaitForCrxInstallerDone()); |
[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 222 | LOG(ERROR) << "PackAndInstallExtension: Extension install"; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 223 | EXPECT_TRUE(mock_prompt->confirmation_requested()); |
[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 224 | LOG(ERROR) << "PackAndInstallExtension: Extension install confirmed"; |
| 225 | } |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 226 | |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 227 | // Tests that scopes are only granted if |record_oauth2_grant_| on the prompt is |
| 228 | // true. |
| 229 | IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, GrantScopes) { |
| 230 | EXPECT_NO_FATAL_FAILURE(CheckHasEmptyScopesAfterInstall("browsertest/scopes", |
| 231 | true)); |
| 232 | } |
| 233 | |
| 234 | IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, DoNotGrantScopes) { |
| 235 | EXPECT_NO_FATAL_FAILURE(CheckHasEmptyScopesAfterInstall("browsertest/scopes", |
| 236 | false)); |
| 237 | } |
| 238 | |
[email protected] | 45dd1b480 | 2012-06-05 23:07:59 | [diff] [blame] | 239 | // Off-store install cannot yet be disabled on Aura. |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 240 | #if defined(USE_AURA) |
[email protected] | 45dd1b480 | 2012-06-05 23:07:59 | [diff] [blame] | 241 | #define MAYBE_AllowOffStore DISABLED_AllowOffStore |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 242 | #else |
[email protected] | 45dd1b480 | 2012-06-05 23:07:59 | [diff] [blame] | 243 | #define MAYBE_AllowOffStore AllowOffStore |
| 244 | #endif |
| 245 | IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, MAYBE_AllowOffStore) { |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 246 | ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 247 | const bool kTestData[] = {false, true}; |
| 248 | |
| 249 | for (size_t i = 0; i < arraysize(kTestData); ++i) { |
[email protected] | 619f8618 | 2012-07-03 21:30:18 | [diff] [blame] | 250 | MockInstallPrompt* mock_prompt = |
| 251 | CreateMockInstallPromptForBrowser(browser()); |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 252 | scoped_refptr<CrxInstaller> crx_installer( |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 253 | CrxInstaller::Create(service, mock_prompt)); |
[email protected] | 7224dbd | 2012-06-05 15:21:50 | [diff] [blame] | 254 | crx_installer->set_install_cause( |
| 255 | extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); |
[email protected] | d903981 | 2012-06-09 06:05:48 | [diff] [blame] | 256 | |
| 257 | if (kTestData[i]) { |
| 258 | crx_installer->set_off_store_install_allow_reason( |
| 259 | CrxInstaller::OffStoreInstallAllowedInTest); |
| 260 | } |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 261 | |
| 262 | crx_installer->InstallCrx(test_data_dir_.AppendASCII("good.crx")); |
| 263 | EXPECT_EQ(kTestData[i], WaitForExtensionInstall()) << kTestData[i]; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 264 | EXPECT_EQ(kTestData[i], mock_prompt->did_succeed()); |
| 265 | EXPECT_EQ(kTestData[i], mock_prompt->confirmation_requested()) << |
| 266 | kTestData[i]; |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 267 | if (kTestData[i]) { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 268 | EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i]; |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 269 | } else { |
| 270 | EXPECT_EQ(l10n_util::GetStringUTF16( |
| 271 | IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 272 | mock_prompt->error()) << kTestData[i]; |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 273 | } |
| 274 | } |
[email protected] | a973689 | 2012-05-30 15:58:05 | [diff] [blame] | 275 | } |
[email protected] | bf3d9df | 2012-07-24 23:20:27 | [diff] [blame^] | 276 | |
| 277 | } // namespace extensions |