| 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/strings/pattern.h" | 7 #include "base/strings/pattern.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 protected: | 177 protected: |
| 178 // The id of the permissions escalation test extension we use. | 178 // The id of the permissions escalation test extension we use. |
| 179 static const char kId[]; | 179 static const char kId[]; |
| 180 | 180 |
| 181 void SetUpOnMainThread() override { | 181 void SetUpOnMainThread() override { |
| 182 EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); | 182 EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); |
| 183 base::FilePath pem_path = test_data_dir_. | 183 base::FilePath pem_path = test_data_dir_. |
| 184 AppendASCII("permissions_increase").AppendASCII("permissions.pem"); | 184 AppendASCII("permissions_increase").AppendASCII("permissions.pem"); |
| 185 base::FilePath path_v1 = PackExtensionWithOptions( | 185 base::FilePath path_v1 = PackExtensionWithOptions( |
| 186 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v1"), | 186 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v1"), |
| 187 scoped_temp_dir_.path().AppendASCII("permissions1.crx"), | 187 scoped_temp_dir_.GetPath().AppendASCII("permissions1.crx"), pem_path, |
| 188 pem_path, | |
| 189 base::FilePath()); | 188 base::FilePath()); |
| 190 base::FilePath path_v2 = PackExtensionWithOptions( | 189 base::FilePath path_v2 = PackExtensionWithOptions( |
| 191 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v2"), | 190 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v2"), |
| 192 scoped_temp_dir_.path().AppendASCII("permissions2.crx"), | 191 scoped_temp_dir_.GetPath().AppendASCII("permissions2.crx"), pem_path, |
| 193 pem_path, | |
| 194 base::FilePath()); | 192 base::FilePath()); |
| 195 | 193 |
| 196 ExtensionService* service = ExtensionSystem::Get(browser()->profile())-> | 194 ExtensionService* service = ExtensionSystem::Get(browser()->profile())-> |
| 197 extension_service(); | 195 extension_service(); |
| 198 | 196 |
| 199 // Install low-permission version of the extension. | 197 // Install low-permission version of the extension. |
| 200 ASSERT_TRUE(InstallExtension(path_v1, 1)); | 198 ASSERT_TRUE(InstallExtension(path_v1, 1)); |
| 201 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); | 199 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); |
| 202 | 200 |
| 203 // Update to a high-permission version - it should get disabled. | 201 // Update to a high-permission version - it should get disabled. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 SetEnabled(false, true, std::string()); | 286 SetEnabled(false, true, std::string()); |
| 289 SetEnabled(true, true, std::string()); | 287 SetEnabled(true, true, std::string()); |
| 290 const Extension* extension = ExtensionSystem::Get(browser()->profile()) | 288 const Extension* extension = ExtensionSystem::Get(browser()->profile()) |
| 291 ->extension_service() | 289 ->extension_service() |
| 292 ->GetExtensionById(kId, false); | 290 ->GetExtensionById(kId, false); |
| 293 EXPECT_TRUE(extension); | 291 EXPECT_TRUE(extension); |
| 294 } | 292 } |
| 295 } | 293 } |
| 296 | 294 |
| 297 } // namespace extensions | 295 } // namespace extensions |
| OLD | NEW |