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

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

Issue 10704052: Download filename determination refactor (3/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with r147256 Created 8 years, 5 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/download/download_crx_util.h" 5 #include "chrome/browser/download/download_crx_util.h"
6 #include "chrome/browser/download/download_service.h" 6 #include "chrome/browser/download/download_service.h"
7 #include "chrome/browser/download/download_service_factory.h" 7 #include "chrome/browser/download/download_service_factory.h"
8 #include "chrome/browser/download/download_test_observer.h" 8 #include "chrome/browser/download/download_test_observer.h"
9 #include "chrome/browser/extensions/crx_installer.h" 9 #include "chrome/browser/extensions/crx_installer.h"
10 #include "chrome/browser/extensions/extension_browsertest.h" 10 #include "chrome/browser/extensions/extension_browsertest.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 #define MAYBE_PackAndInstallExtension DISABLED_PackAndInstallExtension 186 #define MAYBE_PackAndInstallExtension DISABLED_PackAndInstallExtension
187 #else 187 #else
188 #define MAYBE_PackAndInstallExtension PackAndInstallExtension 188 #define MAYBE_PackAndInstallExtension PackAndInstallExtension
189 #endif 189 #endif
190 IN_PROC_BROWSER_TEST_F( 190 IN_PROC_BROWSER_TEST_F(
191 ExtensionCrxInstallerTest, MAYBE_PackAndInstallExtension) { 191 ExtensionCrxInstallerTest, MAYBE_PackAndInstallExtension) {
192 if (!extensions::switch_utils::IsEasyOffStoreInstallEnabled()) 192 if (!extensions::switch_utils::IsEasyOffStoreInstallEnabled())
193 return; 193 return;
194 194
195 const int kNumDownloadsExpected = 1; 195 const int kNumDownloadsExpected = 1;
196 const bool kExpectFileSelectDialog = false;
197 196
198 LOG(ERROR) << "PackAndInstallExtension: Packing extension"; 197 LOG(ERROR) << "PackAndInstallExtension: Packing extension";
199 FilePath crx_path = PackExtension( 198 FilePath crx_path = PackExtension(
200 test_data_dir_.AppendASCII("common/background_page")); 199 test_data_dir_.AppendASCII("common/background_page"));
201 ASSERT_FALSE(crx_path.empty()); 200 ASSERT_FALSE(crx_path.empty());
202 std::string crx_path_string(crx_path.value().begin(), crx_path.value().end()); 201 std::string crx_path_string(crx_path.value().begin(), crx_path.value().end());
203 GURL url = GURL(std::string("file:///").append(crx_path_string)); 202 GURL url = GURL(std::string("file:///").append(crx_path_string));
204 203
205 MockInstallPrompt* mock_prompt = 204 MockInstallPrompt* mock_prompt =
206 CreateMockInstallPromptForBrowser(browser()); 205 CreateMockInstallPromptForBrowser(browser());
207 download_crx_util::SetMockInstallPromptForTesting(mock_prompt); 206 download_crx_util::SetMockInstallPromptForTesting(mock_prompt);
208 207
209 LOG(ERROR) << "PackAndInstallExtension: Getting download manager"; 208 LOG(ERROR) << "PackAndInstallExtension: Getting download manager";
210 content::DownloadManager* download_manager = 209 content::DownloadManager* download_manager =
211 content::BrowserContext::GetDownloadManager(browser()->profile()); 210 content::BrowserContext::GetDownloadManager(browser()->profile());
212 211
213 LOG(ERROR) << "PackAndInstallExtension: Setting observer"; 212 LOG(ERROR) << "PackAndInstallExtension: Setting observer";
214 scoped_ptr<DownloadTestObserver> observer( 213 scoped_ptr<DownloadTestObserver> observer(
215 new DownloadTestObserverTerminal( 214 new DownloadTestObserverTerminal(
216 download_manager, kNumDownloadsExpected, kExpectFileSelectDialog, 215 download_manager, kNumDownloadsExpected,
217 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); 216 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT));
218 LOG(ERROR) << "PackAndInstallExtension: Navigating to URL"; 217 LOG(ERROR) << "PackAndInstallExtension: Navigating to URL";
219 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 218 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB,
220 ui_test_utils::BROWSER_TEST_NONE); 219 ui_test_utils::BROWSER_TEST_NONE);
221 220
222 EXPECT_TRUE(WaitForCrxInstallerDone()); 221 EXPECT_TRUE(WaitForCrxInstallerDone());
223 LOG(ERROR) << "PackAndInstallExtension: Extension install"; 222 LOG(ERROR) << "PackAndInstallExtension: Extension install";
224 EXPECT_TRUE(mock_prompt->confirmation_requested()); 223 EXPECT_TRUE(mock_prompt->confirmation_requested());
225 LOG(ERROR) << "PackAndInstallExtension: Extension install confirmed"; 224 LOG(ERROR) << "PackAndInstallExtension: Extension install confirmed";
226 } 225 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 kTestData[i]; 266 kTestData[i];
268 if (kTestData[i]) { 267 if (kTestData[i]) {
269 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i]; 268 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i];
270 } else { 269 } else {
271 EXPECT_EQ(l10n_util::GetStringUTF16( 270 EXPECT_EQ(l10n_util::GetStringUTF16(
272 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), 271 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE),
273 mock_prompt->error()) << kTestData[i]; 272 mock_prompt->error()) << kTestData[i];
274 } 273 }
275 } 274 }
276 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698