Chromium Code Reviews| 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/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/download/download_crx_util.h" | 8 #include "chrome/browser/download/download_crx_util.h" |
| 9 #include "chrome/browser/extensions/browser_action_test_util.h" | 9 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 10 #include "chrome/browser/extensions/crx_installer.h" | 10 #include "chrome/browser/extensions/crx_installer.h" |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 557 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, ManagementPolicy) { | 557 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, ManagementPolicy) { |
| 558 ManagementPolicyMock policy; | 558 ManagementPolicyMock policy; |
| 559 extensions::ExtensionSystem::Get(profile()) | 559 extensions::ExtensionSystem::Get(profile()) |
| 560 ->management_policy() | 560 ->management_policy() |
| 561 ->RegisterProvider(&policy); | 561 ->RegisterProvider(&policy); |
| 562 | 562 |
| 563 base::FilePath crx_path = test_data_dir_.AppendASCII("crx_installer/v1.crx"); | 563 base::FilePath crx_path = test_data_dir_.AppendASCII("crx_installer/v1.crx"); |
| 564 EXPECT_FALSE(InstallExtension(crx_path, 0)); | 564 EXPECT_FALSE(InstallExtension(crx_path, 0)); |
| 565 } | 565 } |
| 566 | 566 |
| 567 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, WithheldElevationCheck) { | |
| 568 // Enable consent flag and install extension. All host permissions will be | |
|
Devlin
2014/09/09 16:04:26
This is actually wrong. It's not that "All host p
gpdavis
2014/09/09 17:48:53
Ah, understood. Will change.
| |
| 569 // withheld. | |
| 570 scoped_ptr<FeatureSwitch::ScopedOverride> enable_scripts_switch( | |
| 571 new FeatureSwitch::ScopedOverride( | |
| 572 FeatureSwitch::scripts_require_action(), true)); | |
| 573 | |
| 574 base::FilePath crx_path = test_data_dir_.AppendASCII("withheld.crx"); | |
|
Devlin
2014/09/09 16:04:26
If we can, let's avoid introducing more crxs into
gpdavis
2014/09/09 17:48:53
Sure thing.
| |
| 575 const extensions::Extension* extension = InstallExtension(crx_path, 1); | |
| 576 EXPECT_TRUE(base::PathExists(extension->path())); | |
| 577 | |
| 578 std::string id = extension->id(); | |
| 579 ExtensionService* service = extensions::ExtensionSystem::Get( | |
| 580 browser()->profile())->extension_service(); | |
| 581 EXPECT_TRUE(service->GetExtensionById(id, false)); | |
|
Devlin
2014/09/09 16:04:26
This really and truly and honestly is fully deprec
gpdavis
2014/09/09 17:48:53
Ah, sorry about that. I borrowed code from anothe
| |
| 582 | |
| 583 // Disable consent flag and reinstall extension. It should now be disabled | |
| 584 // because previously withheld permissions are now being requested. | |
| 585 enable_scripts_switch.reset(); | |
| 586 extension = InstallExtension(crx_path, -1); | |
| 587 EXPECT_FALSE(service->IsExtensionEnabled(id)); | |
| 588 } | |
| 589 | |
| 567 } // namespace extensions | 590 } // namespace extensions |
| OLD | NEW |