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

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 r148594 to and resolve conflicts with r148576 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 #define MAYBE_PackAndInstallExtension DISABLED_PackAndInstallExtension 185 #define MAYBE_PackAndInstallExtension DISABLED_PackAndInstallExtension
186 #else 186 #else
187 #define MAYBE_PackAndInstallExtension PackAndInstallExtension 187 #define MAYBE_PackAndInstallExtension PackAndInstallExtension
188 #endif 188 #endif
189 IN_PROC_BROWSER_TEST_F( 189 IN_PROC_BROWSER_TEST_F(
190 ExtensionCrxInstallerTest, MAYBE_PackAndInstallExtension) { 190 ExtensionCrxInstallerTest, MAYBE_PackAndInstallExtension) {
191 if (!switch_utils::IsEasyOffStoreInstallEnabled()) 191 if (!switch_utils::IsEasyOffStoreInstallEnabled())
192 return; 192 return;
193 193
194 const int kNumDownloadsExpected = 1; 194 const int kNumDownloadsExpected = 1;
195 const bool kExpectFileSelectDialog = false;
196 195
197 LOG(ERROR) << "PackAndInstallExtension: Packing extension"; 196 LOG(ERROR) << "PackAndInstallExtension: Packing extension";
198 FilePath crx_path = PackExtension( 197 FilePath crx_path = PackExtension(
199 test_data_dir_.AppendASCII("common/background_page")); 198 test_data_dir_.AppendASCII("common/background_page"));
200 ASSERT_FALSE(crx_path.empty()); 199 ASSERT_FALSE(crx_path.empty());
201 std::string crx_path_string(crx_path.value().begin(), crx_path.value().end()); 200 std::string crx_path_string(crx_path.value().begin(), crx_path.value().end());
202 GURL url = GURL(std::string("file:///").append(crx_path_string)); 201 GURL url = GURL(std::string("file:///").append(crx_path_string));
203 202
204 MockInstallPrompt* mock_prompt = 203 MockInstallPrompt* mock_prompt =
205 CreateMockInstallPromptForBrowser(browser()); 204 CreateMockInstallPromptForBrowser(browser());
206 download_crx_util::SetMockInstallPromptForTesting(mock_prompt); 205 download_crx_util::SetMockInstallPromptForTesting(mock_prompt);
207 206
208 LOG(ERROR) << "PackAndInstallExtension: Getting download manager"; 207 LOG(ERROR) << "PackAndInstallExtension: Getting download manager";
209 content::DownloadManager* download_manager = 208 content::DownloadManager* download_manager =
210 content::BrowserContext::GetDownloadManager(browser()->profile()); 209 content::BrowserContext::GetDownloadManager(browser()->profile());
211 210
212 LOG(ERROR) << "PackAndInstallExtension: Setting observer"; 211 LOG(ERROR) << "PackAndInstallExtension: Setting observer";
213 scoped_ptr<DownloadTestObserver> observer( 212 scoped_ptr<DownloadTestObserver> observer(
214 new DownloadTestObserverTerminal( 213 new DownloadTestObserverTerminal(
215 download_manager, kNumDownloadsExpected, kExpectFileSelectDialog, 214 download_manager, kNumDownloadsExpected,
216 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); 215 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT));
217 LOG(ERROR) << "PackAndInstallExtension: Navigating to URL"; 216 LOG(ERROR) << "PackAndInstallExtension: Navigating to URL";
218 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 217 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB,
219 ui_test_utils::BROWSER_TEST_NONE); 218 ui_test_utils::BROWSER_TEST_NONE);
220 219
221 EXPECT_TRUE(WaitForCrxInstallerDone()); 220 EXPECT_TRUE(WaitForCrxInstallerDone());
222 LOG(ERROR) << "PackAndInstallExtension: Extension install"; 221 LOG(ERROR) << "PackAndInstallExtension: Extension install";
223 EXPECT_TRUE(mock_prompt->confirmation_requested()); 222 EXPECT_TRUE(mock_prompt->confirmation_requested());
224 LOG(ERROR) << "PackAndInstallExtension: Extension install confirmed"; 223 LOG(ERROR) << "PackAndInstallExtension: Extension install confirmed";
225 } 224 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i]; 267 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i];
269 } else { 268 } else {
270 EXPECT_EQ(l10n_util::GetStringUTF16( 269 EXPECT_EQ(l10n_util::GetStringUTF16(
271 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), 270 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE),
272 mock_prompt->error()) << kTestData[i]; 271 mock_prompt->error()) << kTestData[i];
273 } 272 }
274 } 273 }
275 } 274 }
276 275
277 } // namespace extensions 276 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698