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

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

Issue 2839373003: struct UnloadedExtensionInfo -> enum UnloadedExtensionInfoReason (Closed)
Patch Set: Rebase Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_service_test_with_install.h" 5 #include "chrome/browser/extensions/extension_service_test_with_install.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/chrome_test_extension_loader.h" 9 #include "chrome/browser/extensions/chrome_test_extension_loader.h"
10 #include "chrome/browser/extensions/crx_installer.h" 10 #include "chrome/browser/extensions/crx_installer.h"
(...skipping 23 matching lines...) Expand all
34 const content::NotificationSource& source, 34 const content::NotificationSource& source,
35 const content::NotificationDetails& details) { 35 const content::NotificationDetails& details) {
36 return content::Source<extensions::CrxInstaller>(source).ptr() == *installer; 36 return content::Source<extensions::CrxInstaller>(source).ptr() == *installer;
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
41 ExtensionServiceTestWithInstall::ExtensionServiceTestWithInstall() 41 ExtensionServiceTestWithInstall::ExtensionServiceTestWithInstall()
42 : installed_(nullptr), 42 : installed_(nullptr),
43 was_update_(false), 43 was_update_(false),
44 unloaded_reason_(UnloadedExtensionInfo::REASON_UNDEFINED), 44 unloaded_reason_(UnloadedExtensionReason::UNDEFINED),
45 expected_extensions_count_(0), 45 expected_extensions_count_(0),
46 override_external_install_prompt_( 46 override_external_install_prompt_(
47 FeatureSwitch::prompt_for_external_extensions(), false), 47 FeatureSwitch::prompt_for_external_extensions(),
48 false),
48 registry_observer_(this) {} 49 registry_observer_(this) {}
49 50
50 ExtensionServiceTestWithInstall::~ExtensionServiceTestWithInstall() {} 51 ExtensionServiceTestWithInstall::~ExtensionServiceTestWithInstall() {}
51 52
52 void ExtensionServiceTestWithInstall::InitializeExtensionService( 53 void ExtensionServiceTestWithInstall::InitializeExtensionService(
53 const ExtensionServiceInitParams& params) { 54 const ExtensionServiceInitParams& params) {
54 ExtensionServiceTestBase::InitializeExtensionService(params); 55 ExtensionServiceTestBase::InitializeExtensionService(params);
55 56
56 registry_observer_.Add(registry()); 57 registry_observer_.Add(registry());
57 } 58 }
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 const Extension* extension) { 383 const Extension* extension) {
383 loaded_.push_back(make_scoped_refptr(extension)); 384 loaded_.push_back(make_scoped_refptr(extension));
384 // The tests rely on the errors being in a certain order, which can vary 385 // The tests rely on the errors being in a certain order, which can vary
385 // depending on how filesystem iteration works. 386 // depending on how filesystem iteration works.
386 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder()); 387 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder());
387 } 388 }
388 389
389 void ExtensionServiceTestWithInstall::OnExtensionUnloaded( 390 void ExtensionServiceTestWithInstall::OnExtensionUnloaded(
390 content::BrowserContext* browser_context, 391 content::BrowserContext* browser_context,
391 const Extension* extension, 392 const Extension* extension,
392 UnloadedExtensionInfo::Reason reason) { 393 UnloadedExtensionReason reason) {
393 unloaded_id_ = extension->id(); 394 unloaded_id_ = extension->id();
394 unloaded_reason_ = reason; 395 unloaded_reason_ = reason;
395 extensions::ExtensionList::iterator i = 396 extensions::ExtensionList::iterator i =
396 std::find(loaded_.begin(), loaded_.end(), extension); 397 std::find(loaded_.begin(), loaded_.end(), extension);
397 // TODO(erikkay) fix so this can be an assert. Right now the tests 398 // TODO(erikkay) fix so this can be an assert. Right now the tests
398 // are manually calling clear() on loaded_, so this isn't doable. 399 // are manually calling clear() on loaded_, so this isn't doable.
399 if (i == loaded_.end()) 400 if (i == loaded_.end())
400 return; 401 return;
401 loaded_.erase(i); 402 loaded_.erase(i);
402 } 403 }
(...skipping 24 matching lines...) Expand all
427 // something was installed by default. That's weird. 428 // something was installed by default. That's weird.
428 extension_loader.set_grant_permissions( 429 extension_loader.set_grant_permissions(
429 (creation_flags & Extension::WAS_INSTALLED_BY_DEFAULT) == 0); 430 (creation_flags & Extension::WAS_INSTALLED_BY_DEFAULT) == 0);
430 // TODO(devlin): We shouldn't ignore manifest warnings here, but we always 431 // TODO(devlin): We shouldn't ignore manifest warnings here, but we always
431 // did so a bunch of stuff fails. Migrate this over. 432 // did so a bunch of stuff fails. Migrate this over.
432 extension_loader.set_ignore_manifest_warnings(true); 433 extension_loader.set_ignore_manifest_warnings(true);
433 extension_loader.LoadExtension(crx_path); 434 extension_loader.LoadExtension(crx_path);
434 } 435 }
435 436
436 } // namespace extensions 437 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698