OLD | NEW |
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 ASSERT_EQ(size_before + 1, service->extensions()->size()); | 430 ASSERT_EQ(size_before + 1, service->extensions()->size()); |
431 const Extension* extension = service->GetExtensionById(kExtensionId, false); | 431 const Extension* extension = service->GetExtensionById(kExtensionId, false); |
432 ASSERT_TRUE(extension); | 432 ASSERT_TRUE(extension); |
433 ASSERT_EQ("2.0", extension->VersionString()); | 433 ASSERT_EQ("2.0", extension->VersionString()); |
434 | 434 |
435 // Uninstalling the extension should set a pref that keeps the extension from | 435 // Uninstalling the extension should set a pref that keeps the extension from |
436 // being installed again the next time external_extensions.json is read. | 436 // being installed again the next time external_extensions.json is read. |
437 | 437 |
438 UninstallExtension(kExtensionId); | 438 UninstallExtension(kExtensionId); |
439 | 439 |
440 extensions::ExtensionPrefs* extension_prefs = service->extension_prefs(); | 440 extensions::ExtensionPrefs* extension_prefs = |
| 441 extensions::ExtensionPrefs::Get(browser()->profile()); |
441 EXPECT_TRUE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId)) | 442 EXPECT_TRUE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId)) |
442 << "Uninstalling should set kill bit on externaly installed extension."; | 443 << "Uninstalling should set kill bit on externaly installed extension."; |
443 | 444 |
444 // Try to install the extension again from an external source. It should fail | 445 // Try to install the extension again from an external source. It should fail |
445 // because of the killbit. | 446 // because of the killbit. |
446 EXPECT_FALSE(pending_extension_manager->AddFromExternalUpdateUrl( | 447 EXPECT_FALSE(pending_extension_manager->AddFromExternalUpdateUrl( |
447 kExtensionId, GURL("http://localhost/autoupdate/manifest"), | 448 kExtensionId, GURL("http://localhost/autoupdate/manifest"), |
448 Manifest::EXTERNAL_PREF_DOWNLOAD, Extension::NO_FLAGS, false)); | 449 Manifest::EXTERNAL_PREF_DOWNLOAD, Extension::NO_FLAGS, false)); |
449 EXPECT_FALSE(pending_extension_manager->IsIdPending(kExtensionId)) | 450 EXPECT_FALSE(pending_extension_manager->IsIdPending(kExtensionId)) |
450 << "External reinstall of a killed extension shouldn't work."; | 451 << "External reinstall of a killed extension shouldn't work."; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 forcelist, kExtensionId, "http://localhost/autoupdate/manifest"); | 631 forcelist, kExtensionId, "http://localhost/autoupdate/manifest"); |
631 } | 632 } |
632 ASSERT_TRUE(WaitForExtensionInstall()); | 633 ASSERT_TRUE(WaitForExtensionInstall()); |
633 ASSERT_EQ(size_before + 1, service->extensions()->size()); | 634 ASSERT_EQ(size_before + 1, service->extensions()->size()); |
634 extension = service->GetExtensionById(kExtensionId, false); | 635 extension = service->GetExtensionById(kExtensionId, false); |
635 ASSERT_TRUE(extension); | 636 ASSERT_TRUE(extension); |
636 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); | 637 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); |
637 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); | 638 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); |
638 EXPECT_TRUE(service->disabled_extensions()->is_empty()); | 639 EXPECT_TRUE(service->disabled_extensions()->is_empty()); |
639 } | 640 } |
OLD | NEW |