| 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/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.h" | 13 #include "chrome/browser/ui/global_error.h" |
| 14 #include "chrome/browser/ui/global_error_service.h" | 14 #include "chrome/browser/ui/global_error_service.h" |
| 15 #include "chrome/browser/ui/global_error_service_factory.h" | 15 #include "chrome/browser/ui/global_error_service_factory.h" |
| 16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 17 | 17 |
| 18 using extensions::Extension; |
| 19 |
| 18 class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest { | 20 class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest { |
| 19 protected: | 21 protected: |
| 20 void SetUpOnMainThread() { | 22 void SetUpOnMainThread() { |
| 21 EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); | 23 EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); |
| 22 service_ = browser()->profile()->GetExtensionService(); | 24 service_ = browser()->profile()->GetExtensionService(); |
| 23 FilePath pem_path = test_data_dir_. | 25 FilePath pem_path = test_data_dir_. |
| 24 AppendASCII("permissions_increase").AppendASCII("permissions.pem"); | 26 AppendASCII("permissions_increase").AppendASCII("permissions.pem"); |
| 25 path_v1_ = PackExtensionWithOptions( | 27 path_v1_ = PackExtensionWithOptions( |
| 26 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v1"), | 28 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v1"), |
| 27 scoped_temp_dir_.path().AppendASCII("permissions1.crx"), | 29 scoped_temp_dir_.path().AppendASCII("permissions1.crx"), |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 GlobalErrorServiceFactory::GetForProfile(browser()->profile())-> | 154 GlobalErrorServiceFactory::GetForProfile(browser()->profile())-> |
| 153 RemoveGlobalError(error); | 155 RemoveGlobalError(error); |
| 154 delete error; | 156 delete error; |
| 155 // Upgrade to version 3, with even higher permissions. Infer from | 157 // Upgrade to version 3, with even higher permissions. Infer from |
| 156 // version 2 having higher-than-granted permissions that it was disabled | 158 // version 2 having higher-than-granted permissions that it was disabled |
| 157 // for permissions increase. | 159 // for permissions increase. |
| 158 extension = UpdateIncreasingPermissionExtension(extension, path_v3_, 0); | 160 extension = UpdateIncreasingPermissionExtension(extension, path_v3_, 0); |
| 159 ASSERT_TRUE(extension); | 161 ASSERT_TRUE(extension); |
| 160 ASSERT_TRUE(GetExtensionDisabledGlobalError()); | 162 ASSERT_TRUE(GetExtensionDisabledGlobalError()); |
| 161 } | 163 } |
| OLD | NEW |