| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 extensions::ExtensionSyncData sync_data = | 226 extensions::ExtensionSyncData sync_data = |
| 227 sync_service->CreateSyncData(*extension); | 227 sync_service->CreateSyncData(*extension); |
| 228 UninstallExtension(extension_id); | 228 UninstallExtension(extension_id); |
| 229 extension = NULL; | 229 extension = NULL; |
| 230 | 230 |
| 231 // Install extension v1. | 231 // Install extension v1. |
| 232 InstallIncreasingPermissionExtensionV1(); | 232 InstallIncreasingPermissionExtensionV1(); |
| 233 | 233 |
| 234 // Note: This interceptor gets requests on the IO thread. | 234 // Note: This interceptor gets requests on the IO thread. |
| 235 net::LocalHostTestURLRequestInterceptor interceptor( | 235 net::LocalHostTestURLRequestInterceptor interceptor( |
| 236 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 236 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| 237 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 237 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
| 238 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 238 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 239 interceptor.SetResponseIgnoreQuery( | 239 interceptor.SetResponseIgnoreQuery( |
| 240 GURL("http://localhost/autoupdate/updates.xml"), | 240 GURL("http://localhost/autoupdate/updates.xml"), |
| 241 test_data_dir_.AppendASCII("permissions_increase") | 241 test_data_dir_.AppendASCII("permissions_increase") |
| 242 .AppendASCII("updates.xml")); | 242 .AppendASCII("updates.xml")); |
| 243 interceptor.SetResponseIgnoreQuery( | 243 interceptor.SetResponseIgnoreQuery( |
| 244 GURL("http://localhost/autoupdate/v2.crx"), | 244 GURL("http://localhost/autoupdate/v2.crx"), |
| 245 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); | 245 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); |
| 246 | 246 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 266 ->GetDisableReasons(extension_id)); | 266 ->GetDisableReasons(extension_id)); |
| 267 EXPECT_TRUE(GetExtensionDisabledGlobalError()); | 267 EXPECT_TRUE(GetExtensionDisabledGlobalError()); |
| 268 } | 268 } |
| 269 | 269 |
| 270 // Test that an error appears if an extension gets installed server side. | 270 // Test that an error appears if an extension gets installed server side. |
| 271 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, RemoteInstall) { | 271 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, RemoteInstall) { |
| 272 static const char extension_id[] = "pgdpcfcocojkjfbgpiianjngphoopgmo"; | 272 static const char extension_id[] = "pgdpcfcocojkjfbgpiianjngphoopgmo"; |
| 273 | 273 |
| 274 // Note: This interceptor gets requests on the IO thread. | 274 // Note: This interceptor gets requests on the IO thread. |
| 275 net::LocalHostTestURLRequestInterceptor interceptor( | 275 net::LocalHostTestURLRequestInterceptor interceptor( |
| 276 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 276 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| 277 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 277 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
| 278 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 278 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 279 interceptor.SetResponseIgnoreQuery( | 279 interceptor.SetResponseIgnoreQuery( |
| 280 GURL("http://localhost/autoupdate/updates.xml"), | 280 GURL("http://localhost/autoupdate/updates.xml"), |
| 281 test_data_dir_.AppendASCII("permissions_increase") | 281 test_data_dir_.AppendASCII("permissions_increase") |
| 282 .AppendASCII("updates.xml")); | 282 .AppendASCII("updates.xml")); |
| 283 interceptor.SetResponseIgnoreQuery( | 283 interceptor.SetResponseIgnoreQuery( |
| 284 GURL("http://localhost/autoupdate/v2.crx"), | 284 GURL("http://localhost/autoupdate/v2.crx"), |
| 285 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); | 285 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); |
| 286 | 286 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 317 | 317 |
| 318 const Extension* extension = service_->GetExtensionById(extension_id, true); | 318 const Extension* extension = service_->GetExtensionById(extension_id, true); |
| 319 ASSERT_TRUE(extension); | 319 ASSERT_TRUE(extension); |
| 320 EXPECT_EQ("2", extension->VersionString()); | 320 EXPECT_EQ("2", extension->VersionString()); |
| 321 EXPECT_EQ(1u, registry_->disabled_extensions().size()); | 321 EXPECT_EQ(1u, registry_->disabled_extensions().size()); |
| 322 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, | 322 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, |
| 323 ExtensionPrefs::Get(service_->profile()) | 323 ExtensionPrefs::Get(service_->profile()) |
| 324 ->GetDisableReasons(extension_id)); | 324 ->GetDisableReasons(extension_id)); |
| 325 EXPECT_TRUE(GetExtensionDisabledGlobalError()); | 325 EXPECT_TRUE(GetExtensionDisabledGlobalError()); |
| 326 } | 326 } |
| OLD | NEW |