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

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

Issue 510943003: Register granting of previously withheld permissions as a permissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve threading issues, add crx installer browser test Created 6 years, 3 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 (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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698