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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
9 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/global_error/global_error.h" | 13 #include "chrome/browser/ui/global_error/global_error.h" |
14 #include "chrome/browser/ui/global_error/global_error_service.h" | 14 #include "chrome/browser/ui/global_error/global_error_service.h" |
15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // Helper function to install an extension and upgrade it to a version | 78 // Helper function to install an extension and upgrade it to a version |
79 // requiring additional permissions. Returns the new disabled Extension. | 79 // requiring additional permissions. Returns the new disabled Extension. |
80 const Extension* InstallAndUpdateIncreasingPermissionsExtension() { | 80 const Extension* InstallAndUpdateIncreasingPermissionsExtension() { |
81 const Extension* extension = InstallIncreasingPermissionExtensionV1(); | 81 const Extension* extension = InstallIncreasingPermissionExtensionV1(); |
82 extension = UpdateIncreasingPermissionExtension(extension, path_v2_, -1); | 82 extension = UpdateIncreasingPermissionExtension(extension, path_v2_, -1); |
83 return extension; | 83 return extension; |
84 } | 84 } |
85 | 85 |
86 ExtensionService* service_; | 86 ExtensionService* service_; |
87 ScopedTempDir scoped_temp_dir_; | 87 base::ScopedTempDir scoped_temp_dir_; |
88 FilePath path_v1_; | 88 FilePath path_v1_; |
89 FilePath path_v2_; | 89 FilePath path_v2_; |
90 FilePath path_v3_; | 90 FilePath path_v3_; |
91 }; | 91 }; |
92 | 92 |
93 // Tests the process of updating an extension to one that requires higher | 93 // Tests the process of updating an extension to one that requires higher |
94 // permissions, and accepting the permissions. | 94 // permissions, and accepting the permissions. |
95 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, AcceptPermissions) { | 95 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, AcceptPermissions) { |
96 const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); | 96 const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); |
97 ASSERT_TRUE(extension); | 97 ASSERT_TRUE(extension); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 GlobalErrorServiceFactory::GetForProfile(browser()->profile())-> | 154 GlobalErrorServiceFactory::GetForProfile(browser()->profile())-> |
155 RemoveGlobalError(error); | 155 RemoveGlobalError(error); |
156 delete error; | 156 delete error; |
157 // Upgrade to version 3, with even higher permissions. Infer from | 157 // Upgrade to version 3, with even higher permissions. Infer from |
158 // version 2 having higher-than-granted permissions that it was disabled | 158 // version 2 having higher-than-granted permissions that it was disabled |
159 // for permissions increase. | 159 // for permissions increase. |
160 extension = UpdateIncreasingPermissionExtension(extension, path_v3_, 0); | 160 extension = UpdateIncreasingPermissionExtension(extension, path_v3_, 0); |
161 ASSERT_TRUE(extension); | 161 ASSERT_TRUE(extension); |
162 ASSERT_TRUE(GetExtensionDisabledGlobalError()); | 162 ASSERT_TRUE(GetExtensionDisabledGlobalError()); |
163 } | 163 } |
OLD | NEW |