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

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

Issue 10683003: Moved CrxInstaller and CrxInstallerError into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest-er master 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
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/extensions/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 239
240 // Simulate a user abort on an extension installation. 240 // Simulate a user abort on an extension installation.
241 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { 241 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) {
242 delegate->InstallUIAbort(true); 242 delegate->InstallUIAbort(true);
243 MessageLoopForUI::current()->Quit(); 243 MessageLoopForUI::current()->Quit();
244 } 244 }
245 245
246 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} 246 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {}
247 247
248 virtual void OnInstallFailure(const CrxInstallerError& error) {} 248 virtual void OnInstallFailure(const extensions::CrxInstallerError& error) {}
249 }; 249 };
250 250
251 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { 251 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt {
252 public: 252 public:
253 explicit MockAutoConfirmExtensionInstallPrompt( 253 explicit MockAutoConfirmExtensionInstallPrompt(
254 gfx::NativeWindow parent, 254 gfx::NativeWindow parent,
255 content::PageNavigator* navigator, 255 content::PageNavigator* navigator,
256 Profile* profile) : ExtensionInstallPrompt(parent, navigator, profile) {} 256 Profile* profile) : ExtensionInstallPrompt(parent, navigator, profile) {}
257 257
258 // Proceed without confirmation prompt. 258 // Proceed without confirmation prompt.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 // TODO(tessamac): Update callers to always pass an unpacked extension 306 // TODO(tessamac): Update callers to always pass an unpacked extension
307 // and then always pack the extension here. 307 // and then always pack the extension here.
308 FilePath crx_path = path; 308 FilePath crx_path = path;
309 if (crx_path.Extension() != FILE_PATH_LITERAL(".crx")) { 309 if (crx_path.Extension() != FILE_PATH_LITERAL(".crx")) {
310 crx_path = PackExtension(path); 310 crx_path = PackExtension(path);
311 } 311 }
312 if (crx_path.empty()) 312 if (crx_path.empty())
313 return NULL; 313 return NULL;
314 314
315 scoped_refptr<CrxInstaller> installer( 315 scoped_refptr<extensions::CrxInstaller> installer(
316 CrxInstaller::Create(service, install_ui)); 316 extensions::CrxInstaller::Create(service, install_ui));
317 installer->set_expected_id(id); 317 installer->set_expected_id(id);
318 installer->set_is_gallery_install(from_webstore); 318 installer->set_is_gallery_install(from_webstore);
319 if (!from_webstore) { 319 if (!from_webstore) {
320 installer->set_off_store_install_allow_reason( 320 installer->set_off_store_install_allow_reason(
321 CrxInstaller::OffStoreInstallAllowedInTest); 321 extensions::CrxInstaller::OffStoreInstallAllowedInTest);
322 } 322 }
323 323
324 content::NotificationRegistrar registrar; 324 content::NotificationRegistrar registrar;
325 registrar.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, 325 registrar.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE,
326 content::Source<CrxInstaller>(installer.get())); 326 content::Source<extensions::CrxInstaller>(installer.get()));
327 327
328 installer->InstallCrx(crx_path); 328 installer->InstallCrx(crx_path);
329 329
330 ui_test_utils::RunMessageLoop(); 330 ui_test_utils::RunMessageLoop();
331 } 331 }
332 332
333 size_t num_after = service->extensions()->size(); 333 size_t num_after = service->extensions()->size();
334 EXPECT_EQ(num_before + expected_change, num_after); 334 EXPECT_EQ(num_before + expected_change, num_after);
335 if (num_before + expected_change != num_after) { 335 if (num_before + expected_change != num_after) {
336 VLOG(1) << "Num extensions before: " << base::IntToString(num_before) 336 VLOG(1) << "Num extensions before: " << base::IntToString(num_before)
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 case content::NOTIFICATION_LOAD_STOP: 632 case content::NOTIFICATION_LOAD_STOP:
633 VLOG(1) << "Got LOAD_STOP notification."; 633 VLOG(1) << "Got LOAD_STOP notification.";
634 MessageLoopForUI::current()->Quit(); 634 MessageLoopForUI::current()->Quit();
635 break; 635 break;
636 636
637 default: 637 default:
638 NOTREACHED(); 638 NOTREACHED();
639 break; 639 break;
640 } 640 }
641 } 641 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer_error.h ('k') | chrome/browser/extensions/extension_install_prompt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698