OLD | NEW |
---|---|
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 4587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4598 pem_path, | 4598 pem_path, |
4599 INSTALL_NEW); | 4599 INSTALL_NEW); |
4600 std::string id = extension_v1->id(); | 4600 std::string id = extension_v1->id(); |
4601 EXPECT_TRUE(service()->IsExtensionEnabled(id)); | 4601 EXPECT_TRUE(service()->IsExtensionEnabled(id)); |
4602 | 4602 |
4603 base::FilePath v2_bad_requirements_crx = GetTemporaryFile(); | 4603 base::FilePath v2_bad_requirements_crx = GetTemporaryFile(); |
4604 | 4604 |
4605 PackCRX(path.AppendASCII("v2_bad_requirements"), | 4605 PackCRX(path.AppendASCII("v2_bad_requirements"), |
4606 pem_path, | 4606 pem_path, |
4607 v2_bad_requirements_crx); | 4607 v2_bad_requirements_crx); |
4608 UpdateExtension(id, v2_bad_requirements_crx, INSTALLED); | 4608 if (content::GpuDataManager::GetInstance()->ShouldUseSwiftShader()) { |
4609 EXPECT_FALSE(service()->IsExtensionEnabled(id)); | 4609 UpdateExtension(id, v2_bad_requirements_crx, ENABLED); |
4610 EXPECT_TRUE(service()->IsExtensionEnabled(id)); | |
Devlin
2017/03/02 21:59:29
Unfortunately, this defeats the purpose of the tes
sugoi
2017/03/06 18:31:42
I've looked into this, and I still think this is t
Devlin
2017/03/06 22:58:10
The thing is, this isn't actually a GPU test, WebG
| |
4611 } else { | |
4612 UpdateExtension(id, v2_bad_requirements_crx, INSTALLED); | |
4613 EXPECT_FALSE(service()->IsExtensionEnabled(id)); | |
4614 } | |
4610 | 4615 |
4611 base::FilePath v3_good_crx = GetTemporaryFile(); | 4616 base::FilePath v3_good_crx = GetTemporaryFile(); |
4612 | 4617 |
4613 PackCRX(path.AppendASCII("v3_good"), pem_path, v3_good_crx); | 4618 PackCRX(path.AppendASCII("v3_good"), pem_path, v3_good_crx); |
4614 UpdateExtension(id, v3_good_crx, ENABLED); | 4619 UpdateExtension(id, v3_good_crx, ENABLED); |
4615 EXPECT_TRUE(service()->IsExtensionEnabled(id)); | 4620 EXPECT_TRUE(service()->IsExtensionEnabled(id)); |
4616 } | 4621 } |
4617 | 4622 |
4618 // Extensions disabled through user action should stay disabled. | 4623 // Extensions disabled through user action should stay disabled. |
4619 TEST_F(ExtensionServiceTest, UpgradingRequirementsDisabled) { | 4624 TEST_F(ExtensionServiceTest, UpgradingRequirementsDisabled) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4680 // Unpacked extensions are not allowed to be installed if they have unsupported | 4685 // Unpacked extensions are not allowed to be installed if they have unsupported |
4681 // requirements. | 4686 // requirements. |
4682 TEST_F(ExtensionServiceTest, UnpackedRequirements) { | 4687 TEST_F(ExtensionServiceTest, UnpackedRequirements) { |
4683 InitializeEmptyExtensionService(); | 4688 InitializeEmptyExtensionService(); |
4684 BlackListWebGL(); | 4689 BlackListWebGL(); |
4685 | 4690 |
4686 base::FilePath path = | 4691 base::FilePath path = |
4687 data_dir().AppendASCII("requirements").AppendASCII("v2_bad_requirements"); | 4692 data_dir().AppendASCII("requirements").AppendASCII("v2_bad_requirements"); |
4688 extensions::UnpackedInstaller::Create(service())->Load(path); | 4693 extensions::UnpackedInstaller::Create(service())->Load(path); |
4689 base::RunLoop().RunUntilIdle(); | 4694 base::RunLoop().RunUntilIdle(); |
4690 EXPECT_EQ(1u, GetErrors().size()); | 4695 if (content::GpuDataManager::GetInstance()->ShouldUseSwiftShader()) { |
4691 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 4696 EXPECT_EQ(0u, GetErrors().size()); |
Devlin
2017/03/02 21:59:29
ditto here
| |
4697 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | |
4698 } else { | |
4699 EXPECT_EQ(1u, GetErrors().size()); | |
4700 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | |
4701 } | |
4692 } | 4702 } |
4693 | 4703 |
4694 class ExtensionCookieCallback { | 4704 class ExtensionCookieCallback { |
4695 public: | 4705 public: |
4696 ExtensionCookieCallback() | 4706 ExtensionCookieCallback() |
4697 : result_(false), | 4707 : result_(false), |
4698 weak_factory_(base::MessageLoop::current()) {} | 4708 weak_factory_(base::MessageLoop::current()) {} |
4699 | 4709 |
4700 void SetCookieCallback(bool result) { | 4710 void SetCookieCallback(bool result) { |
4701 base::ThreadTaskRunnerHandle::Get()->PostTask( | 4711 base::ThreadTaskRunnerHandle::Get()->PostTask( |
(...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7196 shared_module->manifest()->type()); | 7206 shared_module->manifest()->type()); |
7197 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); | 7207 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); |
7198 | 7208 |
7199 // Reload the extension and wait for it to complete. This previously crashed | 7209 // Reload the extension and wait for it to complete. This previously crashed |
7200 // (see crbug.com/676815). | 7210 // (see crbug.com/676815). |
7201 service()->ReloadExtension(kExtensionId); | 7211 service()->ReloadExtension(kExtensionId); |
7202 base::RunLoop().RunUntilIdle(); | 7212 base::RunLoop().RunUntilIdle(); |
7203 // The shared module should be enabled. | 7213 // The shared module should be enabled. |
7204 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); | 7214 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); |
7205 } | 7215 } |
OLD | NEW |