| 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 "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" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // service_->GrantPermissionsAndEnableExtension(extension, false); | 182 // service_->GrantPermissionsAndEnableExtension(extension, false); |
| 183 extensions::ExtensionSyncData sync_data = | 183 extensions::ExtensionSyncData sync_data = |
| 184 service_->GetExtensionSyncData(*extension); | 184 service_->GetExtensionSyncData(*extension); |
| 185 UninstallExtension(extension_id); | 185 UninstallExtension(extension_id); |
| 186 extension = NULL; | 186 extension = NULL; |
| 187 | 187 |
| 188 // Install extension v1. | 188 // Install extension v1. |
| 189 InstallIncreasingPermissionExtensionV1(); | 189 InstallIncreasingPermissionExtensionV1(); |
| 190 | 190 |
| 191 // Note: This interceptor gets requests on the IO thread. | 191 // Note: This interceptor gets requests on the IO thread. |
| 192 content::URLRequestPrepackagedInterceptor interceptor; | 192 content::URLLocalHostRequestPrepackagedInterceptor interceptor; |
| 193 net::URLFetcher::SetEnableInterceptionForTests(true); | 193 net::URLFetcher::SetEnableInterceptionForTests(true); |
| 194 interceptor.SetResponseIgnoreQuery( | 194 interceptor.SetResponseIgnoreQuery( |
| 195 GURL("http://localhost/autoupdate/updates.xml"), | 195 GURL("http://localhost/autoupdate/updates.xml"), |
| 196 test_data_dir_.AppendASCII("permissions_increase") | 196 test_data_dir_.AppendASCII("permissions_increase") |
| 197 .AppendASCII("updates.xml")); | 197 .AppendASCII("updates.xml")); |
| 198 interceptor.SetResponseIgnoreQuery( | 198 interceptor.SetResponseIgnoreQuery( |
| 199 GURL("http://localhost/autoupdate/v2.crx"), | 199 GURL("http://localhost/autoupdate/v2.crx"), |
| 200 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); | 200 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); |
| 201 | 201 |
| 202 extensions::ExtensionUpdater::CheckParams params; | 202 extensions::ExtensionUpdater::CheckParams params; |
| 203 params.check_blacklist = false; | 203 params.check_blacklist = false; |
| 204 service_->updater()->set_default_check_params(params); | 204 service_->updater()->set_default_check_params(params); |
| 205 | 205 |
| 206 // Sync is replacing an older version, so it pends. | 206 // Sync is replacing an older version, so it pends. |
| 207 EXPECT_FALSE(service_->ProcessExtensionSyncData(sync_data)); | 207 EXPECT_FALSE(service_->ProcessExtensionSyncData(sync_data)); |
| 208 | 208 |
| 209 WaitForExtensionInstall(); | 209 WaitForExtensionInstall(); |
| 210 | 210 |
| 211 extension = service_->GetExtensionById(extension_id, true); | 211 extension = service_->GetExtensionById(extension_id, true); |
| 212 ASSERT_TRUE(extension); | 212 ASSERT_TRUE(extension); |
| 213 EXPECT_EQ("2", extension->VersionString()); | 213 EXPECT_EQ("2", extension->VersionString()); |
| 214 EXPECT_EQ(1u, service_->disabled_extensions()->size()); | 214 EXPECT_EQ(1u, service_->disabled_extensions()->size()); |
| 215 EXPECT_EQ(Extension::DISABLE_PERMISSIONS_INCREASE, | 215 EXPECT_EQ(Extension::DISABLE_PERMISSIONS_INCREASE, |
| 216 service_->extension_prefs()->GetDisableReasons(extension_id)); | 216 service_->extension_prefs()->GetDisableReasons(extension_id)); |
| 217 EXPECT_TRUE(GetExtensionDisabledGlobalError()); | 217 EXPECT_TRUE(GetExtensionDisabledGlobalError()); |
| 218 } | 218 } |
| OLD | NEW |