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

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

Issue 2908513002: Include terminated extensions while retrieving extension version. (Closed)
Patch Set: add regression browser_test Created 3 years, 6 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/runtime/update_terminated_extension/pem.pem » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 4296 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 EXPECT_FALSE(registry()->GetExtensionById( 4307 EXPECT_FALSE(registry()->GetExtensionById(
4308 good_crx, extensions::ExtensionRegistry::TERMINATED)); 4308 good_crx, extensions::ExtensionRegistry::TERMINATED));
4309 EXPECT_TRUE(service()->GetExtensionById(good_crx, true)); 4309 EXPECT_TRUE(service()->GetExtensionById(good_crx, true));
4310 4310
4311 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 4311 EXPECT_EQ(0u, registry()->enabled_extensions().size());
4312 EXPECT_EQ(1u, registry()->disabled_extensions().size()); 4312 EXPECT_EQ(1u, registry()->disabled_extensions().size());
4313 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 4313 EXPECT_EQ(0u, registry()->terminated_extensions().size());
4314 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 4314 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
4315 } 4315 }
4316 4316
4317 // Regression test for https://crbug.com/724563.
4318 TEST_F(ExtensionServiceTest, TerminatedExtensionStoredVersion) {
Devlin 2017/05/25 19:17:39 Could we actually move this to extension_registry_
4319 InitializeEmptyExtensionService();
4320 InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW);
4321 TerminateExtension(good_crx);
4322 EXPECT_TRUE(registry()->GetExtensionById(
4323 good_crx, extensions::ExtensionRegistry::TERMINATED));
4324 base::Version version = registry()->GetStoredVersion(good_crx);
4325 ASSERT_TRUE(version.IsValid());
4326 EXPECT_EQ("1.0.0.0", version.GetString());
4327 }
4328
4317 // Tests that with the kDisableExtensions flag, extensions are not loaded by 4329 // Tests that with the kDisableExtensions flag, extensions are not loaded by
4318 // the ExtensionService... 4330 // the ExtensionService...
4319 TEST_F(ExtensionServiceTest, PRE_DisableAllExtensions) { 4331 TEST_F(ExtensionServiceTest, PRE_DisableAllExtensions) {
4320 base::CommandLine::ForCurrentProcess()->AppendSwitch( 4332 base::CommandLine::ForCurrentProcess()->AppendSwitch(
4321 switches::kDisableExtensions); 4333 switches::kDisableExtensions);
4322 InitializeGoodInstalledExtensionService(); 4334 InitializeGoodInstalledExtensionService();
4323 service()->Init(); 4335 service()->Init();
4324 EXPECT_TRUE(registry()->GenerateInstalledExtensionsSet()->is_empty()); 4336 EXPECT_TRUE(registry()->GenerateInstalledExtensionsSet()->is_empty());
4325 } 4337 }
4326 4338
(...skipping 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after
6959 shared_module->manifest()->type()); 6971 shared_module->manifest()->type());
6960 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); 6972 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId));
6961 6973
6962 // Reload the extension and wait for it to complete. This previously crashed 6974 // Reload the extension and wait for it to complete. This previously crashed
6963 // (see crbug.com/676815). 6975 // (see crbug.com/676815).
6964 service()->ReloadExtension(kExtensionId); 6976 service()->ReloadExtension(kExtensionId);
6965 content::RunAllBlockingPoolTasksUntilIdle(); 6977 content::RunAllBlockingPoolTasksUntilIdle();
6966 // The shared module should be enabled. 6978 // The shared module should be enabled.
6967 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); 6979 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId));
6968 } 6980 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/runtime/update_terminated_extension/pem.pem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698